Chromium Code Reviews| Index: chrome/browser/policy/profile_policy_connector.cc |
| diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc |
| index f0281228d94617ca797faee41e6893a9c1822d5b..5048a1d21f162e62a206440ce2cad460649327ae 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 { |
| @@ -40,6 +41,7 @@ ProfilePolicyConnector::ProfilePolicyConnector(Profile* profile) |
| identity_strategy_.reset(new UserPolicyIdentityStrategy( |
| profile_, |
| policy_cache_dir.Append(kTokenCacheFile))); |
| + |
|
Mattias Nissler (ping if slow)
2011/05/31 12:35:53
why the added newline?
sfeuz
2011/05/31 12:52:18
Done.
|
| cloud_policy_subsystem_.reset(new CloudPolicySubsystem( |
| identity_strategy_.get(), |
| new UserPolicyCache(policy_cache_dir.Append(kPolicyCacheFile)))); |
| @@ -72,14 +74,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()); |
|
Mattias Nissler (ping if slow)
2011/05/31 12:35:53
indentation
sfeuz
2011/05/31 12:52:18
Done.
|
| + } |
| } |
| 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* |