OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/device_token_fetcher.h" | 5 #include "chrome/browser/policy/device_token_fetcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | |
11 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/time.h" |
12 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 12 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
13 #include "chrome/browser/policy/cloud_policy_data_store.h" | 13 #include "chrome/browser/policy/cloud_policy_data_store.h" |
| 14 #include "chrome/browser/policy/delayed_work_scheduler.h" |
14 #include "chrome/browser/policy/device_management_service.h" | 15 #include "chrome/browser/policy/device_management_service.h" |
15 #include "chrome/browser/policy/enterprise_metrics.h" | 16 #include "chrome/browser/policy/enterprise_metrics.h" |
| 17 #include "chrome/browser/policy/policy_notifier.h" |
16 #include "chrome/browser/policy/proto/device_management_constants.h" | 18 #include "chrome/browser/policy/proto/device_management_constants.h" |
17 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 19 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 // Retry after 5 minutes (with exponential backoff) after token fetch errors. | 23 // Retry after 5 minutes (with exponential backoff) after token fetch errors. |
22 const int64 kTokenFetchErrorDelayMilliseconds = 5 * 60 * 1000; | 24 const int64 kTokenFetchErrorDelayMilliseconds = 5 * 60 * 1000; |
23 // Retry after max 3 hours after token fetch errors. | 25 // Retry after max 3 hours after token fetch errors. |
24 const int64 kTokenFetchErrorMaxDelayMilliseconds = 3 * 60 * 60 * 1000; | 26 const int64 kTokenFetchErrorMaxDelayMilliseconds = 3 * 60 * 60 * 1000; |
25 // For unmanaged devices, check once per day whether they're still unmanaged. | 27 // For unmanaged devices, check once per day whether they're still unmanaged. |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 case STATE_UNMANAGED: | 235 case STATE_UNMANAGED: |
234 case STATE_ERROR: | 236 case STATE_ERROR: |
235 case STATE_TEMPORARY_ERROR: | 237 case STATE_TEMPORARY_ERROR: |
236 case STATE_BAD_AUTH: | 238 case STATE_BAD_AUTH: |
237 FetchTokenInternal(); | 239 FetchTokenInternal(); |
238 break; | 240 break; |
239 } | 241 } |
240 } | 242 } |
241 | 243 |
242 } // namespace policy | 244 } // namespace policy |
OLD | NEW |