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_subsystem.h" | 5 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 12 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
13 #include "chrome/browser/policy/cloud_policy_controller.h" | 13 #include "chrome/browser/policy/cloud_policy_controller.h" |
14 #include "chrome/browser/policy/cloud_policy_data_store.h" | 14 #include "chrome/browser/policy/cloud_policy_data_store.h" |
15 #include "chrome/browser/policy/device_management_service.h" | 15 #include "chrome/browser/policy/device_management_service.h" |
16 #include "chrome/browser/policy/device_token_fetcher.h" | 16 #include "chrome/browser/policy/device_token_fetcher.h" |
17 #include "chrome/browser/policy/policy_notifier.h" | 17 #include "chrome/browser/policy/policy_notifier.h" |
| 18 #include "chrome/browser/prefs/pref_registrar_simple.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // Default refresh rate. | 28 // Default refresh rate. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 137 |
137 void CloudPolicySubsystem::RefreshPolicies(bool wait_for_auth_token) { | 138 void CloudPolicySubsystem::RefreshPolicies(bool wait_for_auth_token) { |
138 data_store_->set_policy_fetching_enabled(true); | 139 data_store_->set_policy_fetching_enabled(true); |
139 if (cloud_policy_controller_.get()) | 140 if (cloud_policy_controller_.get()) |
140 cloud_policy_controller_->RefreshPolicies(wait_for_auth_token); | 141 cloud_policy_controller_->RefreshPolicies(wait_for_auth_token); |
141 // Make sure the |device_management_service_| is rolling. | 142 // Make sure the |device_management_service_| is rolling. |
142 device_management_service_->ScheduleInitialization(0); | 143 device_management_service_->ScheduleInitialization(0); |
143 } | 144 } |
144 | 145 |
145 // static | 146 // static |
146 void CloudPolicySubsystem::RegisterPrefs(PrefServiceSimple* pref_service) { | 147 void CloudPolicySubsystem::RegisterPrefs(PrefRegistrarSimple* pref_service) { |
147 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, | 148 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, |
148 kDefaultPolicyRefreshRateMs); | 149 kDefaultPolicyRefreshRateMs); |
149 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, | 150 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, |
150 kDefaultPolicyRefreshRateMs); | 151 kDefaultPolicyRefreshRateMs); |
151 } | 152 } |
152 | 153 |
153 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { | 154 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { |
154 if (cloud_policy_controller_.get()) { | 155 if (cloud_policy_controller_.get()) { |
155 // Clamp to sane values. | 156 // Clamp to sane values. |
156 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); | 157 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { | 193 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { |
193 return cloud_policy_cache_.get(); | 194 return cloud_policy_cache_.get(); |
194 } | 195 } |
195 | 196 |
196 CloudPolicySubsystem::CloudPolicySubsystem() | 197 CloudPolicySubsystem::CloudPolicySubsystem() |
197 : refresh_pref_name_(NULL), | 198 : refresh_pref_name_(NULL), |
198 data_store_(NULL) { | 199 data_store_(NULL) { |
199 } | 200 } |
200 | 201 |
201 } // namespace policy | 202 } // namespace policy |
OLD | NEW |