| Index: chrome/browser/policy/cloud_policy_subsystem.cc
|
| diff --git a/chrome/browser/policy/cloud_policy_subsystem.cc b/chrome/browser/policy/cloud_policy_subsystem.cc
|
| index 5ed979a967586a8f55deff175d9f729c90f50605..0016938d5aca17ae16d5240132c906900d8a00e9 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"
|
| @@ -50,8 +51,7 @@ CloudPolicySubsystem::ObserverRegistrar::~ObserverRegistrar() {
|
|
|
| CloudPolicySubsystem::CloudPolicySubsystem(
|
| CloudPolicyIdentityStrategy* identity_strategy,
|
| - CloudPolicyCacheBase* policy_cache)
|
| - : prefs_(NULL) {
|
| + CloudPolicyCacheBase* policy_cache) {
|
| net::NetworkChangeNotifier::AddIPAddressObserver(this);
|
| notifier_.reset(new PolicyNotifier());
|
| CommandLine* command_line = CommandLine::ForCurrentProcess();
|
| @@ -77,7 +77,6 @@ CloudPolicySubsystem::CloudPolicySubsystem(
|
| }
|
|
|
| CloudPolicySubsystem::~CloudPolicySubsystem() {
|
| - DCHECK(!prefs_);
|
| cloud_policy_controller_.reset();
|
| device_token_fetcher_.reset();
|
| cloud_policy_cache_.reset();
|
| @@ -93,15 +92,15 @@ void CloudPolicySubsystem::OnIPAddressChanged() {
|
| }
|
|
|
| void CloudPolicySubsystem::Initialize(
|
| - PrefService* prefs,
|
| + const char* refresh_pref_name,
|
| net::URLRequestContextGetter* request_context) {
|
| - DCHECK(!prefs_);
|
| - prefs_ = prefs;
|
| -
|
| if (device_management_service_.get())
|
| device_management_service_->Initialize(request_context);
|
|
|
| - policy_refresh_rate_.Init(prefs::kPolicyRefreshRate, prefs_, this);
|
| + policy_refresh_rate_.Init(refresh_pref_name,
|
| + g_browser_process->local_state(),
|
| + this);
|
| +
|
| UpdatePolicyRefreshRate();
|
| }
|
|
|
| @@ -111,7 +110,6 @@ void CloudPolicySubsystem::Shutdown() {
|
| cloud_policy_controller_.reset();
|
| cloud_policy_cache_.reset();
|
| policy_refresh_rate_.Destroy();
|
| - prefs_ = NULL;
|
| }
|
|
|
| CloudPolicySubsystem::PolicySubsystemState CloudPolicySubsystem::state() {
|
| @@ -144,7 +142,10 @@ 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);
|
| }
|
| @@ -164,8 +165,9 @@ void CloudPolicySubsystem::Observe(NotificationType type,
|
| const NotificationDetails& details) {
|
| if (type == NotificationType::PREF_CHANGED &&
|
| policy_refresh_rate_.GetPrefName() ==
|
| - *(Details<std::string>(details).ptr()) &&
|
| - prefs_ == Source<PrefService>(source).ptr()) {
|
| + *(Details<std::string>(details).ptr())) {
|
| + DCHECK_EQ(Source<PrefService>(source).ptr(),
|
| + g_browser_process->local_state());
|
| UpdatePolicyRefreshRate();
|
| } else {
|
| NOTREACHED();
|
|
|