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/policy/cloud/cloud_policy_refresh_scheduler.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
16 #include "base/time/tick_clock.h" | 16 #include "base/time/tick_clock.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
18 #include "components/policy/core/common/policy_switches.h" | 18 #include "components/policy/core/common/policy_switches.h" |
19 | 19 |
20 namespace policy { | 20 namespace policy { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // The maximum rate at which to refresh policies. | 24 // The maximum rate at which to refresh policies. |
25 const size_t kMaxRefreshesPerHour = 5; | 25 const size_t kMaxRefreshesPerHour = 5; |
26 | 26 |
27 // The maximum time to wait for the invalidations service to become available | 27 // The maximum time to wait for the invalidations service to become available |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 void CloudPolicyRefreshScheduler::OnWaitForInvalidationServiceTimeout() { | 366 void CloudPolicyRefreshScheduler::OnWaitForInvalidationServiceTimeout() { |
367 wait_for_invalidations_timeout_callback_.Cancel(); | 367 wait_for_invalidations_timeout_callback_.Cancel(); |
368 ScheduleRefresh(); | 368 ScheduleRefresh(); |
369 } | 369 } |
370 | 370 |
371 bool CloudPolicyRefreshScheduler::WaitingForInvalidationService() const { | 371 bool CloudPolicyRefreshScheduler::WaitingForInvalidationService() const { |
372 return !wait_for_invalidations_timeout_callback_.IsCancelled(); | 372 return !wait_for_invalidations_timeout_callback_.IsCancelled(); |
373 } | 373 } |
374 | 374 |
375 } // namespace policy | 375 } // namespace policy |
OLD | NEW |