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

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

Issue 10805057: Modified PolicyService to register observers by domain only, instead of domain and component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/policy/policy_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/configuration_policy_pref_store.h" 5 #include "chrome/browser/policy/configuration_policy_pref_store.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 27 matching lines...) Expand all
38 38
39 } // namespace 39 } // namespace
40 40
41 ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore( 41 ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
42 PolicyService* service, 42 PolicyService* service,
43 PolicyLevel level) 43 PolicyLevel level)
44 : policy_service_(service), 44 : policy_service_(service),
45 level_(level) { 45 level_(level) {
46 // Read initial policy. 46 // Read initial policy.
47 prefs_.reset(CreatePreferencesFromPolicies()); 47 prefs_.reset(CreatePreferencesFromPolicies());
48 policy_service_->AddObserver(POLICY_DOMAIN_CHROME, "", this); 48 policy_service_->AddObserver(POLICY_DOMAIN_CHROME, this);
49 } 49 }
50 50
51 void ConfigurationPolicyPrefStore::AddObserver(PrefStore::Observer* observer) { 51 void ConfigurationPolicyPrefStore::AddObserver(PrefStore::Observer* observer) {
52 observers_.AddObserver(observer); 52 observers_.AddObserver(observer);
53 } 53 }
54 54
55 void ConfigurationPolicyPrefStore::RemoveObserver( 55 void ConfigurationPolicyPrefStore::RemoveObserver(
56 PrefStore::Observer* observer) { 56 PrefStore::Observer* observer) {
57 observers_.RemoveObserver(observer); 57 observers_.RemoveObserver(observer);
58 } 58 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // static 103 // static
104 ConfigurationPolicyPrefStore* 104 ConfigurationPolicyPrefStore*
105 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( 105 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(
106 PolicyService* policy_service) { 106 PolicyService* policy_service) {
107 return new ConfigurationPolicyPrefStore(policy_service, 107 return new ConfigurationPolicyPrefStore(policy_service,
108 POLICY_LEVEL_RECOMMENDED); 108 POLICY_LEVEL_RECOMMENDED);
109 } 109 }
110 110
111 ConfigurationPolicyPrefStore::~ConfigurationPolicyPrefStore() { 111 ConfigurationPolicyPrefStore::~ConfigurationPolicyPrefStore() {
112 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, "", this); 112 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this);
113 } 113 }
114 114
115 void ConfigurationPolicyPrefStore::Refresh() { 115 void ConfigurationPolicyPrefStore::Refresh() {
116 scoped_ptr<PrefValueMap> new_prefs(CreatePreferencesFromPolicies()); 116 scoped_ptr<PrefValueMap> new_prefs(CreatePreferencesFromPolicies());
117 std::vector<std::string> changed_prefs; 117 std::vector<std::string> changed_prefs;
118 new_prefs->GetDifferingKeys(prefs_.get(), &changed_prefs); 118 new_prefs->GetDifferingKeys(prefs_.get(), &changed_prefs);
119 prefs_.swap(new_prefs); 119 prefs_.swap(new_prefs);
120 120
121 // Send out change notifications. 121 // Send out change notifications.
122 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin()); 122 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin());
(...skipping 23 matching lines...) Expand all
146 // issue during startup. 146 // issue during startup.
147 BrowserThread::PostTask(BrowserThread::UI, 147 BrowserThread::PostTask(BrowserThread::UI,
148 FROM_HERE, 148 FROM_HERE,
149 base::Bind(&LogErrors, 149 base::Bind(&LogErrors,
150 base::Owned(errors.release()))); 150 base::Owned(errors.release())));
151 151
152 return prefs.release(); 152 return prefs.release();
153 } 153 }
154 154
155 } // namespace policy 155 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/policy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698