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 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // If the client has switched to not registered, we bail out as this | 228 // If the client has switched to not registered, we bail out as this |
229 // indicates the cloud policy setup flow has been aborted. | 229 // indicates the cloud policy setup flow has been aborted. |
230 CancelWaitForPolicyFetch(); | 230 CancelWaitForPolicyFetch(); |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 void UserCloudPolicyManagerChromeOS::OnClientError( | 235 void UserCloudPolicyManagerChromeOS::OnClientError( |
236 CloudPolicyClient* cloud_policy_client) { | 236 CloudPolicyClient* cloud_policy_client) { |
237 DCHECK_EQ(client(), cloud_policy_client); | 237 DCHECK_EQ(client(), cloud_policy_client); |
238 CancelWaitForPolicyFetch(); | |
239 | |
240 if (wait_for_policy_fetch_) { | 238 if (wait_for_policy_fetch_) { |
241 UMA_HISTOGRAM_SPARSE_SLOWLY(kUMAInitialFetchClientError, | 239 UMA_HISTOGRAM_SPARSE_SLOWLY(kUMAInitialFetchClientError, |
242 cloud_policy_client->status()); | 240 cloud_policy_client->status()); |
243 } | 241 } |
| 242 CancelWaitForPolicyFetch(); |
244 } | 243 } |
245 | 244 |
246 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyRefreshNeeded() { | 245 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyRefreshNeeded() { |
247 core()->RefreshSoon(); | 246 core()->RefreshSoon(); |
248 } | 247 } |
249 | 248 |
250 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { | 249 void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { |
251 CheckAndPublishPolicy(); | 250 CheckAndPublishPolicy(); |
252 StartRefreshSchedulerIfReady(); | 251 StartRefreshSchedulerIfReady(); |
253 } | 252 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 UMA_HISTOGRAM_SPARSE_SLOWLY(kUMAInitialFetchOAuth2NetworkError, | 298 UMA_HISTOGRAM_SPARSE_SLOWLY(kUMAInitialFetchOAuth2NetworkError, |
300 error.network_error()); | 299 error.network_error()); |
301 } | 300 } |
302 } | 301 } |
303 | 302 |
304 token_fetcher_.reset(); | 303 token_fetcher_.reset(); |
305 } | 304 } |
306 | 305 |
307 void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete( | 306 void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete( |
308 bool success) { | 307 bool success) { |
309 | |
310 const base::Time now = base::Time::Now(); | 308 const base::Time now = base::Time::Now(); |
311 UMA_HISTOGRAM_TIMES(kUMAInitialFetchDelayPolicyFetch, | 309 UMA_HISTOGRAM_TIMES(kUMAInitialFetchDelayPolicyFetch, |
312 now - time_client_registered_); | 310 now - time_client_registered_); |
313 UMA_HISTOGRAM_TIMES(kUMAInitialFetchDelayTotal, now - time_init_started_); | 311 UMA_HISTOGRAM_TIMES(kUMAInitialFetchDelayTotal, now - time_init_started_); |
314 CancelWaitForPolicyFetch(); | 312 CancelWaitForPolicyFetch(); |
315 } | 313 } |
316 | 314 |
317 void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch() { | 315 void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch() { |
318 if (!wait_for_policy_fetch_) | 316 if (!wait_for_policy_fetch_) |
319 return; | 317 return; |
(...skipping 21 matching lines...) Expand all Loading... |
341 // start the scheduler. The |component_policy_service_| will call back into | 339 // start the scheduler. The |component_policy_service_| will call back into |
342 // OnComponentCloudPolicyUpdated() once it's ready. | 340 // OnComponentCloudPolicyUpdated() once it's ready. |
343 return; | 341 return; |
344 } | 342 } |
345 | 343 |
346 core()->StartRefreshScheduler(); | 344 core()->StartRefreshScheduler(); |
347 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); | 345 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); |
348 } | 346 } |
349 | 347 |
350 } // namespace policy | 348 } // namespace policy |
OLD | NEW |