| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |