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

Unified Diff: chrome/browser/policy/profile_policy_connector.cc

Issue 7014036: Split the policy refresh rate preference into user- and device-policy refresh rate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits. Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
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..5059574bd34b5b2ec21125c74c5407ea05c4c5e0 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*
« no previous file with comments | « chrome/browser/policy/profile_policy_connector.h ('k') | chrome/browser/policy/proto/chrome_device_policy.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698