| 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_controller.h" | 5 #include "chrome/browser/policy/cloud_policy_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/guid.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 15 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 16 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
| 16 #include "chrome/browser/policy/cloud_policy_constants.h" | 17 #include "chrome/browser/policy/cloud_policy_constants.h" |
| 17 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 18 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 18 #include "chrome/browser/policy/delayed_work_scheduler.h" | 19 #include "chrome/browser/policy/delayed_work_scheduler.h" |
| 19 #include "chrome/browser/policy/device_management_service.h" | 20 #include "chrome/browser/policy/device_management_service.h" |
| 20 #include "chrome/browser/policy/device_token_fetcher.h" | 21 #include "chrome/browser/policy/device_token_fetcher.h" |
| 21 #include "chrome/browser/policy/enterprise_metrics.h" | 22 #include "chrome/browser/policy/enterprise_metrics.h" |
| 22 #include "chrome/browser/policy/policy_notifier.h" | 23 #include "chrome/browser/policy/policy_notifier.h" |
| 23 #include "chrome/common/guid.h" | |
| 24 | 24 |
| 25 namespace policy { | 25 namespace policy { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // The maximum ratio in percent of the policy refresh rate we use for adjusting | 29 // The maximum ratio in percent of the policy refresh rate we use for adjusting |
| 30 // the policy refresh time instant. The rationale is to avoid load spikes from | 30 // the policy refresh time instant. The rationale is to avoid load spikes from |
| 31 // many devices that were set up in sync for some reason. | 31 // many devices that were set up in sync for some reason. |
| 32 const int kPolicyRefreshDeviationFactorPercent = 10; | 32 const int kPolicyRefreshDeviationFactorPercent = 10; |
| 33 // Maximum deviation we are willing to accept. | 33 // Maximum deviation we are willing to accept. |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 base::Time CloudPolicyController::GetLastRefreshTime(const base::Time& now) { | 486 base::Time CloudPolicyController::GetLastRefreshTime(const base::Time& now) { |
| 487 base::Time last_refresh(cache_->last_policy_refresh_time()); | 487 base::Time last_refresh(cache_->last_policy_refresh_time()); |
| 488 if (last_refresh.is_null()) | 488 if (last_refresh.is_null()) |
| 489 last_refresh = now; | 489 last_refresh = now; |
| 490 | 490 |
| 491 return last_refresh; | 491 return last_refresh; |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace policy | 494 } // namespace policy |
| OLD | NEW |