OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" |
14 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 16 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
15 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 17 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
16 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" | 18 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_service.h" | 19 #include "chrome/browser/policy/cloud/cloud_policy_service.h" |
18 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" | 20 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" |
19 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 21 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
20 | 22 |
21 class GoogleServiceAuthError; | 23 class GoogleServiceAuthError; |
22 class PrefService; | 24 class PrefService; |
23 | 25 |
(...skipping 14 matching lines...) Expand all Loading... |
38 public CloudPolicyClient::Observer, | 40 public CloudPolicyClient::Observer, |
39 public CloudPolicyService::Observer, | 41 public CloudPolicyService::Observer, |
40 public ComponentCloudPolicyService::Delegate, | 42 public ComponentCloudPolicyService::Delegate, |
41 public BrowserContextKeyedService { | 43 public BrowserContextKeyedService { |
42 public: | 44 public: |
43 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return | 45 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return |
44 // false as long as there hasn't been a successful policy fetch. | 46 // false as long as there hasn't been a successful policy fetch. |
45 UserCloudPolicyManagerChromeOS( | 47 UserCloudPolicyManagerChromeOS( |
46 scoped_ptr<CloudPolicyStore> store, | 48 scoped_ptr<CloudPolicyStore> store, |
47 scoped_ptr<ResourceCache> resource_cache, | 49 scoped_ptr<ResourceCache> resource_cache, |
48 bool wait_for_policy_fetch); | 50 bool wait_for_policy_fetch, |
| 51 base::TimeDelta initial_policy_fetch_timeout); |
49 virtual ~UserCloudPolicyManagerChromeOS(); | 52 virtual ~UserCloudPolicyManagerChromeOS(); |
50 | 53 |
51 // Initializes the cloud connection. |local_state| and | 54 // Initializes the cloud connection. |local_state| and |
52 // |device_management_service| must stay valid until this object is deleted. | 55 // |device_management_service| must stay valid until this object is deleted. |
53 void Connect(PrefService* local_state, | 56 void Connect(PrefService* local_state, |
54 DeviceManagementService* device_management_service, | 57 DeviceManagementService* device_management_service, |
55 scoped_refptr<net::URLRequestContextGetter> request_context, | 58 scoped_refptr<net::URLRequestContextGetter> request_context, |
56 UserAffiliation user_affiliation); | 59 UserAffiliation user_affiliation); |
57 | 60 |
58 // This class is one of the policy providers, and must be ready for the | 61 // This class is one of the policy providers, and must be ready for the |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 scoped_ptr<CloudPolicyStore> store_; | 119 scoped_ptr<CloudPolicyStore> store_; |
117 | 120 |
118 // Handles fetching and storing cloud policy for components. It uses the | 121 // Handles fetching and storing cloud policy for components. It uses the |
119 // |store_|, so destroy it first. | 122 // |store_|, so destroy it first. |
120 scoped_ptr<ComponentCloudPolicyService> component_policy_service_; | 123 scoped_ptr<ComponentCloudPolicyService> component_policy_service_; |
121 | 124 |
122 // Whether to wait for a policy fetch to complete before reporting | 125 // Whether to wait for a policy fetch to complete before reporting |
123 // IsInitializationComplete(). | 126 // IsInitializationComplete(). |
124 bool wait_for_policy_fetch_; | 127 bool wait_for_policy_fetch_; |
125 | 128 |
| 129 // A timer that puts a hard limit on the maximum time to wait for the intial |
| 130 // policy fetch. |
| 131 base::Timer policy_fetch_timeout_; |
| 132 |
126 // The pref service to pass to the refresh scheduler on initialization. | 133 // The pref service to pass to the refresh scheduler on initialization. |
127 PrefService* local_state_; | 134 PrefService* local_state_; |
128 | 135 |
129 // Used to fetch the policy OAuth token, when necessary. This object holds | 136 // Used to fetch the policy OAuth token, when necessary. This object holds |
130 // a callback with an unretained reference to the manager, when it exists. | 137 // a callback with an unretained reference to the manager, when it exists. |
131 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; | 138 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; |
132 | 139 |
133 // The access token passed to OnAccessTokenAvailable. It is stored here so | 140 // The access token passed to OnAccessTokenAvailable. It is stored here so |
134 // that it can be used if OnInitializationCompleted is called later. | 141 // that it can be used if OnInitializationCompleted is called later. |
135 std::string access_token_; | 142 std::string access_token_; |
136 | 143 |
137 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); | 144 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); |
138 }; | 145 }; |
139 | 146 |
140 } // namespace policy | 147 } // namespace policy |
141 | 148 |
142 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 149 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
OLD | NEW |