diff options
author | sfeuz@chromium.org <sfeuz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-06 17:54:26 +0000 |
---|---|---|
committer | sfeuz@chromium.org <sfeuz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-06 17:54:26 +0000 |
commit | 3b4df8c7ec9b8263d5b394bbbbe62d3106eaffdd (patch) | |
tree | 7bc2c788ecc552f2ec0e90d8cfceffc542d315b5 /chrome | |
parent | 692f266e1c13313a0ed2a861d801e56f0dfa028a (diff) | |
download | chromium_src-3b4df8c7ec9b8263d5b394bbbbe62d3106eaffdd.zip chromium_src-3b4df8c7ec9b8263d5b394bbbbe62d3106eaffdd.tar.gz chromium_src-3b4df8c7ec9b8263d5b394bbbbe62d3106eaffdd.tar.bz2 |
Split the policy refresh rate preference into user- and device-policy refresh rate.
This is an effort towards removing dependencies of the ProfilePolicyConnector on Profile.
BUG=none
TEST=Verify that user- and device-refresh rate are set correctly when specified by policy.
Review URL: http://codereview.chromium.org/7014036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/policy/policy_templates.json | 22 | ||||
-rw-r--r-- | chrome/browser/policy/browser_policy_connector.cc | 3 | ||||
-rw-r--r-- | chrome/browser/policy/cloud_policy_subsystem.cc | 52 | ||||
-rw-r--r-- | chrome/browser/policy/cloud_policy_subsystem.h | 14 | ||||
-rw-r--r-- | chrome/browser/policy/config_dir_policy_provider_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 6 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/device_policy_cache.cc | 11 | ||||
-rw-r--r-- | chrome/browser/policy/device_policy_cache_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/policy/profile_policy_connector.cc | 17 | ||||
-rw-r--r-- | chrome/browser/policy/profile_policy_connector.h | 4 | ||||
-rw-r--r-- | chrome/browser/policy/proto/chrome_device_policy.proto | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/browser_prefs.cc | 2 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 11 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 4 |
15 files changed, 113 insertions, 60 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 6832d0d..2e60552 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -94,7 +94,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 89 +# For your editing convenience: highest ID currently used: 90 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -1331,10 +1331,10 @@ 'features': {'dynamic_refresh': 1}, 'example_value': 3600000, 'id': 56, - 'caption': '''Policy refresh rate''', - 'desc': '''Specifies the period in milliseconds at which the device management service is queried for policy information. + 'caption': '''Refresh rate for user policy''', + 'desc': '''Specifies the period in milliseconds at which the device management service is queried for user policy information. - Setting this policy overrides the default value of 3 hours. Valid values for this policy are in the range from 30 minutes to 1 day. Any values not in this range will be clamped to the respective boundary.''', + Setting this policy overrides the default value of 3 hours. Valid values for this policy are in the range from 1800000 (30 minutes) to 86400000 (1 day). Any values not in this range will be clamped to the respective boundary.''', }, { 'name': 'ChromeFrameRendererSettings', @@ -1552,6 +1552,20 @@ If you set this policy, <ph name="PRODUCT_NAME">$3<ex>Google Chrome Frame</ex></ph> will use the provided directory.''', 'label': '''Set user data directory''', }, + { + 'name': 'DevicePolicyRefreshRate', + 'type': 'int', + 'supported_on': ['chrome_os:1.0-'], + 'device_only': True, + 'features': {'dynamic_refresh': 1}, + 'example_value': 3600000, + 'id': 90, + 'caption': '''Refresh rate for Device Policy''', + 'desc': '''Specifies the period in milliseconds at which the device management service is queried for device policy information. + + Setting this policy overrides the default value of 3 hours. Valid values for this policy are in the range from 1800000 (30 minutes) to 86400000 (1 day). Any values not in this range will be clamped to the respective boundary.''', + }, + ], 'messages': { # Messages that are not associated to any policies. diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index 1f6a22d..6dd42f1 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -13,6 +13,7 @@ #include "chrome/browser/policy/dummy_configuration_policy_provider.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/pref_names.h" #if defined(OS_WIN) #include "chrome/browser/policy/configuration_policy_provider_win.h" @@ -211,7 +212,7 @@ void BrowserPolicyConnector::FetchPolicy() { void BrowserPolicyConnector::Initialize() { if (cloud_policy_subsystem_.get()) { cloud_policy_subsystem_->Initialize( - g_browser_process->local_state(), + prefs::kDevicePolicyRefreshRate, kServiceInitializationStartupDelay); } } diff --git a/chrome/browser/policy/cloud_policy_subsystem.cc b/chrome/browser/policy/cloud_policy_subsystem.cc index 1d35547..b4ed8a0 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.cc +++ b/chrome/browser/policy/cloud_policy_subsystem.cc @@ -8,6 +8,7 @@ #include <string> #include "base/command_line.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/policy/cloud_policy_cache_base.h" #include "chrome/browser/policy/cloud_policy_controller.h" #include "chrome/browser/policy/cloud_policy_identity_strategy.h" @@ -51,8 +52,7 @@ CloudPolicySubsystem::ObserverRegistrar::~ObserverRegistrar() { CloudPolicySubsystem::CloudPolicySubsystem( CloudPolicyIdentityStrategy* identity_strategy, CloudPolicyCacheBase* policy_cache) - : prefs_(NULL), - identity_strategy_(identity_strategy) { + : identity_strategy_(identity_strategy) { net::NetworkChangeNotifier::AddIPAddressObserver(this); notifier_.reset(new PolicyNotifier()); CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -71,7 +71,6 @@ CloudPolicySubsystem::CloudPolicySubsystem( } CloudPolicySubsystem::~CloudPolicySubsystem() { - DCHECK(!prefs_); cloud_policy_controller_.reset(); device_token_fetcher_.reset(); cloud_policy_cache_.reset(); @@ -86,14 +85,16 @@ void CloudPolicySubsystem::OnIPAddressChanged() { } } -void CloudPolicySubsystem::Initialize( - PrefService* prefs, - int64 delay_milliseconds) { - DCHECK(!prefs_); - prefs_ = prefs; - +void CloudPolicySubsystem::Initialize(const char* refresh_pref_name, + int64 delay_milliseconds) { CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { + DCHECK(device_management_service_.get()); + DCHECK(cloud_policy_cache_.get()); + DCHECK(device_token_fetcher_.get()); + DCHECK(identity_strategy_); + + refresh_pref_name_ = refresh_pref_name; DCHECK(!cloud_policy_controller_.get()); cloud_policy_controller_.reset( new CloudPolicyController(device_management_service_.get(), @@ -101,13 +102,15 @@ void CloudPolicySubsystem::Initialize( device_token_fetcher_.get(), identity_strategy_, notifier_.get())); - } - if (device_management_service_.get()) device_management_service_->ScheduleInitialization(delay_milliseconds); - policy_refresh_rate_.Init(prefs::kPolicyRefreshRate, prefs_, this); - UpdatePolicyRefreshRate(); + PrefService* local_state = g_browser_process->local_state(); + DCHECK(pref_change_registrar_.IsEmpty()); + pref_change_registrar_.Init(local_state); + pref_change_registrar_.Add(refresh_pref_name_, this); + UpdatePolicyRefreshRate(local_state->GetInteger(refresh_pref_name_)); + } } void CloudPolicySubsystem::Shutdown() { @@ -115,8 +118,7 @@ void CloudPolicySubsystem::Shutdown() { device_management_service_->Shutdown(); cloud_policy_controller_.reset(); cloud_policy_cache_.reset(); - policy_refresh_rate_.Destroy(); - prefs_ = NULL; + pref_change_registrar_.RemoveAll(); } CloudPolicySubsystem::PolicySubsystemState CloudPolicySubsystem::state() { @@ -149,15 +151,17 @@ ConfigurationPolicyProvider* // static void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { - pref_service->RegisterIntegerPref(prefs::kPolicyRefreshRate, + pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, + kDefaultPolicyRefreshRateMs, + PrefService::UNSYNCABLE_PREF); + pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, kDefaultPolicyRefreshRateMs, PrefService::UNSYNCABLE_PREF); } -void CloudPolicySubsystem::UpdatePolicyRefreshRate() { +void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { if (cloud_policy_controller_.get()) { // Clamp to sane values. - int64 refresh_rate = policy_refresh_rate_.GetValue(); refresh_rate = std::max(kPolicyRefreshRateMinMs, refresh_rate); refresh_rate = std::min(kPolicyRefreshRateMaxMs, refresh_rate); cloud_policy_controller_->SetRefreshRate(refresh_rate); @@ -167,11 +171,13 @@ void CloudPolicySubsystem::UpdatePolicyRefreshRate() { void CloudPolicySubsystem::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED && - policy_refresh_rate_.GetPrefName() == - *(Details<std::string>(details).ptr()) && - prefs_ == Source<PrefService>(source).ptr()) { - UpdatePolicyRefreshRate(); + if (type == NotificationType::PREF_CHANGED) { + DCHECK_EQ(*(Details<std::string>(details).ptr()), + std::string(refresh_pref_name_)); + PrefService* pref_service = Source<PrefService>(source).ptr(); + // Temporarily also consider the profile preference service as a valid + // source, since we cannot yet push user cloud policy to |local_state|. + UpdatePolicyRefreshRate(pref_service->GetInteger(refresh_pref_name_)); } else { NOTREACHED(); } diff --git a/chrome/browser/policy/cloud_policy_subsystem.h b/chrome/browser/policy/cloud_policy_subsystem.h index 5ecfdaa..2e6e608 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.h +++ b/chrome/browser/policy/cloud_policy_subsystem.h @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/prefs/pref_member.h" +#include "chrome/browser/prefs/pref_change_registrar.h" #include "content/common/notification_observer.h" #include "net/base/network_change_notifier.h" @@ -75,9 +76,9 @@ class CloudPolicySubsystem // net::NetworkChangeNotifier::IPAddressObserver: virtual void OnIPAddressChanged() OVERRIDE; - // Initializes the subsystem.The first network request will only be made + // Initializes the subsystem. The first network request will only be made // after |delay_milliseconds|. - void Initialize(PrefService* prefs, int64 delay_milliseconds); + void Initialize(const char* refresh_pref_name, int64 delay_milliseconds); // Shuts the subsystem down. This must be called before threading and network // infrastructure goes away. @@ -102,7 +103,7 @@ class CloudPolicySubsystem private: // Updates the policy controller with a new refresh rate value. - void UpdatePolicyRefreshRate(); + void UpdatePolicyRefreshRate(int64 refresh_rate); // Returns a weak pointer to this subsystem's PolicyNotifier. PolicyNotifier* notifier() { @@ -114,11 +115,10 @@ class CloudPolicySubsystem const NotificationSource& source, const NotificationDetails& details); - // The pref service that controls the refresh rate. - PrefService* prefs_; + // Name of the preference to read the refresh rate from. + const char* refresh_pref_name_; - // Tracks the pref value for the policy refresh rate. - IntegerPrefMember policy_refresh_rate_; + PrefChangeRegistrar pref_change_registrar_; // Weak reference to pass on to |cloud_policy_controller_| on creation. CloudPolicyIdentityStrategy* identity_strategy_; diff --git a/chrome/browser/policy/config_dir_policy_provider_unittest.cc b/chrome/browser/policy/config_dir_policy_provider_unittest.cc index c3f958e..12ff884 100644 --- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc +++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc @@ -328,6 +328,9 @@ INSTANTIATE_TEST_CASE_P( kPolicyPrintingEnabled, key::kPrintingEnabled), ValueTestParams::ForIntegerPolicy( + kPolicyDevicePolicyRefreshRate, + key::kDevicePolicyRefreshRate), + ValueTestParams::ForIntegerPolicy( kPolicyPolicyRefreshRate, key::kPolicyRefreshRate), ValueTestParams::ForBooleanPolicy( diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 129cd68..b7a29cf 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -259,7 +259,9 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry { Value::TYPE_BOOLEAN, kPolicyDisablePluginFinder, prefs::kDisablePluginFinder }, { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, - prefs::kPolicyRefreshRate }, + prefs::kUserPolicyRefreshRate }, + { Value::TYPE_INTEGER, kPolicyDevicePolicyRefreshRate, + prefs::kDevicePolicyRefreshRate }, { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, { Value::TYPE_BOOLEAN, kPolicyDefaultBrowserSettingEnabled, prefs::kDefaultBrowserSettingEnabled }, @@ -1069,6 +1071,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { key::kDisablePluginFinder }, { kPolicyPolicyRefreshRate, Value::TYPE_INTEGER, key::kPolicyRefreshRate }, + { kPolicyDevicePolicyRefreshRate, Value::TYPE_INTEGER, + key::kDevicePolicyRefreshRate }, { kPolicyInstantEnabled, Value::TYPE_BOOLEAN, key::kInstantEnabled }, { kPolicyDefaultBrowserSettingEnabled, Value::TYPE_BOOLEAN, key::kDefaultBrowserSettingEnabled }, diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index 6b9ada0..d209228 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -273,7 +273,7 @@ INSTANTIATE_TEST_CASE_P( TypeAndName(kPolicyRestoreOnStartup, prefs::kRestoreOnStartup), TypeAndName(kPolicyPolicyRefreshRate, - prefs::kPolicyRefreshRate))); + prefs::kUserPolicyRefreshRate))); // Test cases for the proxy policy settings. class ConfigurationPolicyPrefStoreProxyTest : public testing::Test { diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc index 2789b05..bb9f533 100644 --- a/chrome/browser/policy/device_policy_cache.cc +++ b/chrome/browser/policy/device_policy_cache.cc @@ -269,12 +269,13 @@ void DevicePolicyCache::DecodeDevicePolicy( const em::ChromeDeviceSettingsProto& policy, PolicyMap* mandatory, PolicyMap* recommended) { - if (policy.has_policy_refresh_rate()) { + if (policy.has_device_policy_refresh_rate()) { const em::DevicePolicyRefreshRateProto container = - policy.policy_refresh_rate(); - if (container.has_policy_refresh_rate()) { - mandatory->Set(kPolicyPolicyRefreshRate, - DecodeIntegerValue(container.policy_refresh_rate())); + policy.device_policy_refresh_rate(); + if (container.has_device_policy_refresh_rate()) { + mandatory->Set(kPolicyDevicePolicyRefreshRate, + DecodeIntegerValue( + container.device_policy_refresh_rate())); } } diff --git a/chrome/browser/policy/device_policy_cache_unittest.cc b/chrome/browser/policy/device_policy_cache_unittest.cc index e5ded55..655e0f3 100644 --- a/chrome/browser/policy/device_policy_cache_unittest.cc +++ b/chrome/browser/policy/device_policy_cache_unittest.cc @@ -64,7 +64,8 @@ void CreateRefreshRatePolicy(em::PolicyFetchResponse* policy, // timestamp, machine_name, policy_type, public key info. em::PolicyData signed_response; em::ChromeDeviceSettingsProto settings; - settings.mutable_policy_refresh_rate()->set_policy_refresh_rate(refresh_rate); + settings.mutable_device_policy_refresh_rate()-> + set_device_policy_refresh_rate(refresh_rate); signed_response.set_username(user); signed_response.set_request_token("dmtoken"); signed_response.set_device_id("deviceid"); @@ -151,7 +152,8 @@ TEST_F(DevicePolicyCacheTest, Startup) { testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_); FundamentalValue expected(120); EXPECT_TRUE(Value::Equals(&expected, - GetMandatoryPolicy(kPolicyPolicyRefreshRate))); + GetMandatoryPolicy( + kPolicyDevicePolicyRefreshRate))); } TEST_F(DevicePolicyCacheTest, SetPolicy) { @@ -169,7 +171,8 @@ TEST_F(DevicePolicyCacheTest, SetPolicy) { testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_); FundamentalValue expected(120); EXPECT_TRUE(Value::Equals(&expected, - GetMandatoryPolicy(kPolicyPolicyRefreshRate))); + GetMandatoryPolicy( + kPolicyDevicePolicyRefreshRate))); // Set new policy information. em::PolicyFetchResponse new_policy; @@ -183,7 +186,8 @@ TEST_F(DevicePolicyCacheTest, SetPolicy) { testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_); FundamentalValue updated_expected(300); EXPECT_TRUE(Value::Equals(&updated_expected, - GetMandatoryPolicy(kPolicyPolicyRefreshRate))); + GetMandatoryPolicy( + kPolicyDevicePolicyRefreshRate))); } TEST_F(DevicePolicyCacheTest, SetPolicyWrongUser) { @@ -209,7 +213,8 @@ TEST_F(DevicePolicyCacheTest, SetPolicyWrongUser) { FundamentalValue expected(120); EXPECT_TRUE(Value::Equals(&expected, - GetMandatoryPolicy(kPolicyPolicyRefreshRate))); + GetMandatoryPolicy( + kPolicyDevicePolicyRefreshRate))); } TEST_F(DevicePolicyCacheTest, SetPolicyNonEnterpriseDevice) { @@ -233,7 +238,8 @@ TEST_F(DevicePolicyCacheTest, SetPolicyNonEnterpriseDevice) { FundamentalValue expected(120); EXPECT_TRUE(Value::Equals(&expected, - GetMandatoryPolicy(kPolicyPolicyRefreshRate))); + GetMandatoryPolicy( + kPolicyDevicePolicyRefreshRate))); } TEST_F(DevicePolicyCacheTest, SetProxyPolicy) { diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc index f028122..5059574 100644 --- a/chrome/browser/policy/profile_policy_connector.cc +++ b/chrome/browser/policy/profile_policy_connector.cc @@ -17,6 +17,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/pref_names.h" namespace { @@ -72,14 +73,24 @@ void ProfilePolicyConnector::ScheduleServiceInitialization( void ProfilePolicyConnector::Initialize() { if (identity_strategy_.get()) identity_strategy_->LoadTokenCache(); - if (cloud_policy_subsystem_.get()) - cloud_policy_subsystem_->Initialize(profile_->GetPrefs(), + if (cloud_policy_subsystem_.get()) { + cloud_policy_subsystem_->Initialize(prefs::kUserPolicyRefreshRate, kServiceInitializationStartupDelay); + // Temporarily set the subsystem to listen to profile pref service, since + // we cannot yet serve user cloud policy to |local_state| and we don't want + // the profile reference in the subsystem. + profile_pref_registrar_.Init(profile_->GetPrefs()); + profile_pref_registrar_.Add(prefs::kUserPolicyRefreshRate, + cloud_policy_subsystem_.get()); + } } void ProfilePolicyConnector::Shutdown() { - if (cloud_policy_subsystem_.get()) + if (cloud_policy_subsystem_.get()) { + // Remove the temporary profile observer. + profile_pref_registrar_.RemoveAll(); cloud_policy_subsystem_->Shutdown(); + } } ConfigurationPolicyProvider* diff --git a/chrome/browser/policy/profile_policy_connector.h b/chrome/browser/policy/profile_policy_connector.h index 4fc572b..6687078 100644 --- a/chrome/browser/policy/profile_policy_connector.h +++ b/chrome/browser/policy/profile_policy_connector.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "chrome/browser/policy/configuration_policy_provider.h" +#include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/profiles/profile_keyed_service.h" class Profile; @@ -56,6 +57,9 @@ class ProfilePolicyConnector : public ProfileKeyedService { scoped_ptr<ConfigurationPolicyProvider> managed_cloud_provider_; scoped_ptr<ConfigurationPolicyProvider> recommended_cloud_provider_; + // Temporarily needed until we can serve user policy to local state. + PrefChangeRegistrar profile_pref_registrar_; + DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector); }; diff --git a/chrome/browser/policy/proto/chrome_device_policy.proto b/chrome/browser/policy/proto/chrome_device_policy.proto index e0ea4fa..969e973 100644 --- a/chrome/browser/policy/proto/chrome_device_policy.proto +++ b/chrome/browser/policy/proto/chrome_device_policy.proto @@ -10,7 +10,7 @@ package enterprise_management; message DevicePolicyRefreshRateProto { // In milliseconds. - optional int64 policy_refresh_rate = 1; + optional int64 device_policy_refresh_rate = 1; } message UserWhitelistProto { @@ -72,7 +72,7 @@ message CameraEnabledProto { } message ChromeDeviceSettingsProto { - optional DevicePolicyRefreshRateProto policy_refresh_rate = 1; + optional DevicePolicyRefreshRateProto device_policy_refresh_rate = 1; optional UserWhitelistProto user_whitelist = 2; optional GuestModeEnabledProto guest_mode_enabled = 3; optional DeviceProxySettingsProto device_proxy_settings = 4; diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 6b90be5..cfdba39 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -163,6 +163,8 @@ void RegisterUserPrefs(PrefService* user_prefs) { TemplateURLModel::RegisterUserPrefs(user_prefs); InstantController::RegisterUserPrefs(user_prefs); NetPrefObserver::RegisterPrefs(user_prefs); + // TODO(sfeuz): Remove registering of cloud policy refresh rate preference in + // |user_prefs| once we can push user cloud policies to local_state. policy::CloudPolicySubsystem::RegisterPrefs(user_prefs); ProtocolHandlerRegistry::RegisterPrefs(user_prefs); } diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 3cc1322..a063f40 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -691,11 +691,6 @@ const char kPinnedTabs[] = "pinned_tabs"; // Boolean that is true when HTTP throttling is enabled. const char kHttpThrottlingEnabled[] = "http_throttling.enabled"; -// Integer that specifies the policy refresh rate for policy in milliseconds. -// Not all values are meaningful, so it is clamped to a sane range by the cloud -// policy subsystem. -const char kPolicyRefreshRate[] = "policy.refresh_rate"; - // Integer containing the default Geolocation content setting. const char kGeolocationDefaultContentSetting[] = "geolocation.default_content_setting"; @@ -1371,4 +1366,10 @@ const char kIgnoredProtocolHandlers[] = // Whether user-specified handlers for protocols and content types can be // specified. const char kCustomHandlersEnabled[] = "custom_handlers.enabled"; + +// Integers that specify the policy refresh rate for device- and user-policy in +// milliseconds. Not all values are meaningful, so it is clamped to a sane range +// by the cloud policy subsystem. +const char kDevicePolicyRefreshRate[] = "policy.device_refresh_rate"; +const char kUserPolicyRefreshRate[] = "policy.user_refresh_rate"; } // namespace prefs diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 4539838..be072f9 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -244,8 +244,6 @@ extern const char kEnableBookmarkBar[]; extern const char kPinnedTabs[]; extern const char kHttpThrottlingEnabled[]; -extern const char kPolicyRefreshRate[]; - extern const char kDisable3DAPIs[]; extern const char kEnableHyperlinkAuditing[]; extern const char kEnableReferrers[]; @@ -505,6 +503,8 @@ extern const char kCustomHandlersEnabled[]; extern const char kUserCreatedLoginItem[]; extern const char kBackgroundModeEnabled[]; +extern const char kDevicePolicyRefreshRate[]; +extern const char kUserPolicyRefreshRate[]; } // namespace prefs #endif // CHROME_COMMON_PREF_NAMES_H_ |