| 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_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/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
| 13 #include "base/time/default_tick_clock.h" | 13 #include "base/time/default_tick_clock.h" |
| 14 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
| 15 #include "chrome/browser/policy/cloud_policy_constants.h" | 15 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 18 | 18 |
| 19 namespace policy { | 19 namespace policy { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // The maximum rate at which to refresh policies. | 23 // The maximum rate at which to refresh policies. |
| 24 const size_t kMaxRefreshesPerHour = 5; | 24 const size_t kMaxRefreshesPerHour = 5; |
| 25 | 25 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 base::TimeDelta delay = | 223 base::TimeDelta delay = |
| 224 std::max((last_refresh_ + delta) - base::Time::NowFromSystemTime(), | 224 std::max((last_refresh_ + delta) - base::Time::NowFromSystemTime(), |
| 225 base::TimeDelta()); | 225 base::TimeDelta()); |
| 226 refresh_callback_.Reset( | 226 refresh_callback_.Reset( |
| 227 base::Bind(&CloudPolicyRefreshScheduler::PerformRefresh, | 227 base::Bind(&CloudPolicyRefreshScheduler::PerformRefresh, |
| 228 base::Unretained(this))); | 228 base::Unretained(this))); |
| 229 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); | 229 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace policy | 232 } // namespace policy |
| OLD | NEW |