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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 class DeviceManagementService; | 37 class DeviceManagementService; |
38 class PolicyOAuth2TokenFetcher; | 38 class PolicyOAuth2TokenFetcher; |
39 class WildcardLoginChecker; | 39 class WildcardLoginChecker; |
40 | 40 |
41 // Implements logic for initializing user policy on Chrome OS. | 41 // Implements logic for initializing user policy on Chrome OS. |
42 class UserCloudPolicyManagerChromeOS : public CloudPolicyManager, | 42 class UserCloudPolicyManagerChromeOS : public CloudPolicyManager, |
43 public CloudPolicyClient::Observer, | 43 public CloudPolicyClient::Observer, |
44 public CloudPolicyService::Observer, | 44 public CloudPolicyService::Observer, |
45 public KeyedService { | 45 public KeyedService { |
46 public: | 46 public: |
47 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return | 47 // If |wait_for_policy_fetch| is true, IsInitializationComplete() is forced to |
48 // false as long as there hasn't been a successful policy fetch. | 48 // false until either there has been a successful policy fetch from the server |
| 49 // or |initial_policy_fetch_timeout| has expired. (The timeout may be set to |
| 50 // TimeDelta::Max() to block permanently.) |
49 // |task_runner| is the runner for policy refresh tasks. | 51 // |task_runner| is the runner for policy refresh tasks. |
50 // |file_task_runner| is used for file operations. Currently this must be the | 52 // |file_task_runner| is used for file operations. Currently this must be the |
51 // FILE BrowserThread. | 53 // FILE BrowserThread. |
52 // |io_task_runner| is used for network IO. Currently this must be the IO | 54 // |io_task_runner| is used for network IO. Currently this must be the IO |
53 // BrowserThread. | 55 // BrowserThread. |
54 UserCloudPolicyManagerChromeOS( | 56 UserCloudPolicyManagerChromeOS( |
55 std::unique_ptr<CloudPolicyStore> store, | 57 std::unique_ptr<CloudPolicyStore> store, |
56 std::unique_ptr<CloudExternalDataManager> external_data_manager, | 58 std::unique_ptr<CloudExternalDataManager> external_data_manager, |
57 const base::FilePath& component_policy_cache_path, | 59 const base::FilePath& component_policy_cache_path, |
58 bool wait_for_policy_fetch, | 60 bool wait_for_policy_fetch, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // IsInitializationComplete(). | 159 // IsInitializationComplete(). |
158 bool wait_for_policy_fetch_; | 160 bool wait_for_policy_fetch_; |
159 | 161 |
160 // Whether we should allow policy fetches to fail, or wait forever until they | 162 // Whether we should allow policy fetches to fail, or wait forever until they |
161 // succeed (typically we won't allow them to fail until we have loaded policy | 163 // succeed (typically we won't allow them to fail until we have loaded policy |
162 // at least once). | 164 // at least once). |
163 bool allow_failed_policy_fetches_; | 165 bool allow_failed_policy_fetches_; |
164 | 166 |
165 // A timer that puts a hard limit on the maximum time to wait for the initial | 167 // A timer that puts a hard limit on the maximum time to wait for the initial |
166 // policy fetch. | 168 // policy fetch. |
167 base::Timer policy_fetch_timeout_; | 169 base::Timer policy_fetch_timeout_{false, false}; |
168 | 170 |
169 // The pref service to pass to the refresh scheduler on initialization. | 171 // The pref service to pass to the refresh scheduler on initialization. |
170 PrefService* local_state_; | 172 PrefService* local_state_; |
171 | 173 |
172 // Used to fetch the policy OAuth token, when necessary. This object holds | 174 // Used to fetch the policy OAuth token, when necessary. This object holds |
173 // a callback with an unretained reference to the manager, when it exists. | 175 // a callback with an unretained reference to the manager, when it exists. |
174 std::unique_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; | 176 std::unique_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; |
175 | 177 |
176 // Keeps alive the wildcard checker while its running. | 178 // Keeps alive the wildcard checker while its running. |
177 std::unique_ptr<WildcardLoginChecker> wildcard_login_checker_; | 179 std::unique_ptr<WildcardLoginChecker> wildcard_login_checker_; |
178 | 180 |
179 // The access token passed to OnAccessTokenAvailable. It is stored here so | 181 // The access token passed to OnAccessTokenAvailable. It is stored here so |
180 // that it can be used if OnInitializationCompleted is called later. | 182 // that it can be used if OnInitializationCompleted is called later. |
181 std::string access_token_; | 183 std::string access_token_; |
182 | 184 |
183 // Timestamps for collecting timing UMA stats. | 185 // Timestamps for collecting timing UMA stats. |
184 base::Time time_init_started_; | 186 base::Time time_init_started_; |
185 base::Time time_init_completed_; | 187 base::Time time_init_completed_; |
186 base::Time time_token_available_; | 188 base::Time time_token_available_; |
187 base::Time time_client_registered_; | 189 base::Time time_client_registered_; |
188 | 190 |
189 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); | 191 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); |
190 }; | 192 }; |
191 | 193 |
192 } // namespace policy | 194 } // namespace policy |
193 | 195 |
194 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
OLD | NEW |