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" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 void CloudPolicySubsystem::RefreshPolicies(bool wait_for_auth_token) { | 137 void CloudPolicySubsystem::RefreshPolicies(bool wait_for_auth_token) { |
138 data_store_->set_policy_fetching_enabled(true); | 138 data_store_->set_policy_fetching_enabled(true); |
139 if (cloud_policy_controller_.get()) | 139 if (cloud_policy_controller_.get()) |
140 cloud_policy_controller_->RefreshPolicies(wait_for_auth_token); | 140 cloud_policy_controller_->RefreshPolicies(wait_for_auth_token); |
141 // Make sure the |device_management_service_| is rolling. | 141 // Make sure the |device_management_service_| is rolling. |
142 device_management_service_->ScheduleInitialization(0); | 142 device_management_service_->ScheduleInitialization(0); |
143 } | 143 } |
144 | 144 |
145 // static | 145 // static |
146 void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { | 146 void CloudPolicySubsystem::RegisterPrefs(PrefServiceSimple* pref_service) { |
147 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, | 147 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, |
148 kDefaultPolicyRefreshRateMs, | 148 kDefaultPolicyRefreshRateMs); |
149 PrefService::UNSYNCABLE_PREF); | |
150 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, | 149 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, |
151 kDefaultPolicyRefreshRateMs, | 150 kDefaultPolicyRefreshRateMs); |
152 PrefService::UNSYNCABLE_PREF); | |
153 } | 151 } |
154 | 152 |
155 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { | 153 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { |
156 if (cloud_policy_controller_.get()) { | 154 if (cloud_policy_controller_.get()) { |
157 // Clamp to sane values. | 155 // Clamp to sane values. |
158 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); | 156 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); |
159 refresh_rate = std::min(kPolicyRefreshRateMaxMs, refresh_rate); | 157 refresh_rate = std::min(kPolicyRefreshRateMaxMs, refresh_rate); |
160 cloud_policy_controller_->SetRefreshRate(refresh_rate); | 158 cloud_policy_controller_->SetRefreshRate(refresh_rate); |
161 } | 159 } |
162 } | 160 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { | 192 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { |
195 return cloud_policy_cache_.get(); | 193 return cloud_policy_cache_.get(); |
196 } | 194 } |
197 | 195 |
198 CloudPolicySubsystem::CloudPolicySubsystem() | 196 CloudPolicySubsystem::CloudPolicySubsystem() |
199 : refresh_pref_name_(NULL), | 197 : refresh_pref_name_(NULL), |
200 data_store_(NULL) { | 198 data_store_(NULL) { |
201 } | 199 } |
202 | 200 |
203 } // namespace policy | 201 } // namespace policy |
OLD | NEW |