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

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

Issue 10386097: Refactored ConfigurationPolicyProvider to provide PolicyBundles instead of PolicyMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 7 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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin()); 120 for (std::vector<std::string>::const_iterator pref(changed_prefs.begin());
121 pref != changed_prefs.end(); 121 pref != changed_prefs.end();
122 ++pref) { 122 ++pref) {
123 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, 123 FOR_EACH_OBSERVER(PrefStore::Observer, observers_,
124 OnPrefValueChanged(*pref)); 124 OnPrefValueChanged(*pref));
125 } 125 }
126 } 126 }
127 127
128 PrefValueMap* ConfigurationPolicyPrefStore::CreatePreferencesFromPolicies() { 128 PrefValueMap* ConfigurationPolicyPrefStore::CreatePreferencesFromPolicies() {
129 scoped_ptr<PrefValueMap> prefs(new PrefValueMap); 129 scoped_ptr<PrefValueMap> prefs(new PrefValueMap);
130 const PolicyMap* policies =
131 policy_service_->GetPolicies(POLICY_DOMAIN_CHROME, "");
132 if (!policies)
133 return prefs.release();
134 PolicyMap filtered_policies; 130 PolicyMap filtered_policies;
135 filtered_policies.CopyFrom(*policies); 131 filtered_policies.CopyFrom(
132 policy_service_->GetPolicies(POLICY_DOMAIN_CHROME, ""));
136 filtered_policies.FilterLevel(level_); 133 filtered_policies.FilterLevel(level_);
137 134
138 scoped_ptr<PolicyErrorMap> errors(new PolicyErrorMap); 135 scoped_ptr<PolicyErrorMap> errors(new PolicyErrorMap);
139 136
140 const ConfigurationPolicyHandlerList* handler_list = 137 const ConfigurationPolicyHandlerList* handler_list =
141 g_browser_process->browser_policy_connector()->GetHandlerList(); 138 g_browser_process->browser_policy_connector()->GetHandlerList();
142 handler_list->ApplyPolicySettings(filtered_policies, 139 handler_list->ApplyPolicySettings(filtered_policies,
143 prefs.get(), 140 prefs.get(),
144 errors.get()); 141 errors.get());
145 142
146 // Retrieve and log the errors once the UI loop is ready. This is only an 143 // Retrieve and log the errors once the UI loop is ready. This is only an
147 // issue during startup. 144 // issue during startup.
148 BrowserThread::PostTask(BrowserThread::UI, 145 BrowserThread::PostTask(BrowserThread::UI,
149 FROM_HERE, 146 FROM_HERE,
150 base::Bind(&LogErrors, 147 base::Bind(&LogErrors,
151 base::Owned(errors.release()))); 148 base::Owned(errors.release())));
152 149
153 return prefs.release(); 150 return prefs.release();
154 } 151 }
155 152
156 } // namespace policy 153 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_provider.cc ('k') | chrome/browser/policy/configuration_policy_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698