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 "components/policy/core/common/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/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 14 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
15 | 15 |
16 namespace policy { | 16 namespace policy { |
17 | 17 |
18 #if defined(OS_ANDROID) || defined(OS_IOS) | 18 #if defined(OS_ANDROID) || defined(OS_IOS) |
19 | 19 |
20 const int64 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs = | 20 const int64 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs = |
21 24 * 60 * 60 * 1000; // 1 day. | 21 24 * 60 * 60 * 1000; // 1 day. |
22 const int64 CloudPolicyRefreshScheduler::kUnmanagedRefreshDelayMs = | 22 const int64 CloudPolicyRefreshScheduler::kUnmanagedRefreshDelayMs = |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 base::TimeDelta delay = | 297 base::TimeDelta delay = |
298 std::max((last_refresh_ + delta) - base::Time::NowFromSystemTime(), | 298 std::max((last_refresh_ + delta) - base::Time::NowFromSystemTime(), |
299 base::TimeDelta()); | 299 base::TimeDelta()); |
300 refresh_callback_.Reset( | 300 refresh_callback_.Reset( |
301 base::Bind(&CloudPolicyRefreshScheduler::PerformRefresh, | 301 base::Bind(&CloudPolicyRefreshScheduler::PerformRefresh, |
302 base::Unretained(this))); | 302 base::Unretained(this))); |
303 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); | 303 task_runner_->PostDelayedTask(FROM_HERE, refresh_callback_.callback(), delay); |
304 } | 304 } |
305 | 305 |
306 } // namespace policy | 306 } // namespace policy |
OLD | NEW |