Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/policy/cloud_policy_subsystem.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP, latest changes from kaiwang@ Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/prefs/pref_service.h"
12 #include "chrome/browser/policy/cloud_policy_cache_base.h" 13 #include "chrome/browser/policy/cloud_policy_cache_base.h"
13 #include "chrome/browser/policy/cloud_policy_controller.h" 14 #include "chrome/browser/policy/cloud_policy_controller.h"
14 #include "chrome/browser/policy/cloud_policy_data_store.h" 15 #include "chrome/browser/policy/cloud_policy_data_store.h"
15 #include "chrome/browser/policy/device_management_service.h" 16 #include "chrome/browser/policy/device_management_service.h"
16 #include "chrome/browser/policy/device_token_fetcher.h" 17 #include "chrome/browser/policy/device_token_fetcher.h"
17 #include "chrome/browser/policy/policy_notifier.h" 18 #include "chrome/browser/policy/policy_notifier.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"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(PrefService* pref_service) { 147 void CloudPolicySubsystem::RegisterPrefs(PrefServiceSyncable* pref_service) {
147 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, 148 pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate,
148 kDefaultPolicyRefreshRateMs, 149 kDefaultPolicyRefreshRateMs,
149 PrefService::UNSYNCABLE_PREF); 150 PrefServiceSyncable::UNSYNCABLE_PREF);
150 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, 151 pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate,
151 kDefaultPolicyRefreshRateMs, 152 kDefaultPolicyRefreshRateMs,
152 PrefService::UNSYNCABLE_PREF); 153 PrefServiceSyncable::UNSYNCABLE_PREF);
153 } 154 }
154 155
155 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { 156 void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) {
156 if (cloud_policy_controller_.get()) { 157 if (cloud_policy_controller_.get()) {
157 // Clamp to sane values. 158 // Clamp to sane values.
158 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); 159 refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate);
159 refresh_rate = std::min(kPolicyRefreshRateMaxMs, refresh_rate); 160 refresh_rate = std::min(kPolicyRefreshRateMaxMs, refresh_rate);
160 cloud_policy_controller_->SetRefreshRate(refresh_rate); 161 cloud_policy_controller_->SetRefreshRate(refresh_rate);
161 } 162 }
162 } 163 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { 195 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const {
195 return cloud_policy_cache_.get(); 196 return cloud_policy_cache_.get();
196 } 197 }
197 198
198 CloudPolicySubsystem::CloudPolicySubsystem() 199 CloudPolicySubsystem::CloudPolicySubsystem()
199 : refresh_pref_name_(NULL), 200 : refresh_pref_name_(NULL),
200 data_store_(NULL) { 201 data_store_(NULL) {
201 } 202 }
202 203
203 } // namespace policy 204 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698