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 "chrome/browser/policy/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/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
18 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 18 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "components/policy/core/common/policy_switches.h" |
20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
21 | 21 |
22 namespace policy { | 22 namespace policy { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // The maximum rate at which to refresh policies. | 26 // The maximum rate at which to refresh policies. |
27 const size_t kMaxRefreshesPerHour = 5; | 27 const size_t kMaxRefreshesPerHour = 5; |
28 | 28 |
29 // The maximum time to wait for the invalidations service to become available | 29 // 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... |
368 void CloudPolicyRefreshScheduler::OnWaitForInvalidationServiceTimeout() { | 368 void CloudPolicyRefreshScheduler::OnWaitForInvalidationServiceTimeout() { |
369 wait_for_invalidations_timeout_callback_.Cancel(); | 369 wait_for_invalidations_timeout_callback_.Cancel(); |
370 ScheduleRefresh(); | 370 ScheduleRefresh(); |
371 } | 371 } |
372 | 372 |
373 bool CloudPolicyRefreshScheduler::WaitingForInvalidationService() const { | 373 bool CloudPolicyRefreshScheduler::WaitingForInvalidationService() const { |
374 return !wait_for_invalidations_timeout_callback_.IsCancelled(); | 374 return !wait_for_invalidations_timeout_callback_.IsCancelled(); |
375 } | 375 } |
376 | 376 |
377 } // namespace policy | 377 } // namespace policy |
OLD | NEW |