| 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_policy_refresh_scheduler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
| 10 #include "chrome/browser/policy/cloud_policy_constants.h" | 10 #include "chrome/browser/policy/cloud_policy_constants.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 13 | 14 |
| 14 namespace policy { | 15 namespace policy { |
| 15 | 16 |
| 16 const int64 CloudPolicyRefreshScheduler::kUnmanagedRefreshDelayMs = | 17 const int64 CloudPolicyRefreshScheduler::kUnmanagedRefreshDelayMs = |
| 17 24 * 60 * 60 * 1000; // 1 day. | 18 24 * 60 * 60 * 1000; // 1 day. |
| 18 const int64 CloudPolicyRefreshScheduler::kInitialErrorRetryDelayMs = | 19 const int64 CloudPolicyRefreshScheduler::kInitialErrorRetryDelayMs = |
| 19 5 * 60 * 1000; // 5 minutes. | 20 5 * 60 * 1000; // 5 minutes. |
| 20 const int64 CloudPolicyRefreshScheduler::kRefreshDelayMinMs = | 21 const int64 CloudPolicyRefreshScheduler::kRefreshDelayMinMs = |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); | 197 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); |
| 197 } | 198 } |
| 198 | 199 |
| 199 int64 CloudPolicyRefreshScheduler::GetRefreshDelay() { | 200 int64 CloudPolicyRefreshScheduler::GetRefreshDelay() { |
| 200 return std::min(std::max<int64>(refresh_delay_.GetValue(), | 201 return std::min(std::max<int64>(refresh_delay_.GetValue(), |
| 201 kRefreshDelayMinMs), | 202 kRefreshDelayMinMs), |
| 202 kRefreshDelayMaxMs); | 203 kRefreshDelayMaxMs); |
| 203 } | 204 } |
| 204 | 205 |
| 205 } // namespace policy | 206 } // namespace policy |
| OLD | NEW |