OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/policy_handlers.h" | 5 #include "chrome/browser/extensions/policy_handlers.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_value_map.h" | 8 #include "base/prefs/pref_value_map.h" |
9 #include "chrome/browser/extensions/external_policy_loader.h" | 9 #include "chrome/browser/extensions/external_policy_loader.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
11 #include "components/policy/core/browser/policy_error_map.h" | 11 #include "components/policy/core/browser/policy_error_map.h" |
12 #include "components/policy/core/common/policy_map.h" | 12 #include "components/policy/core/common/policy_map.h" |
| 13 #include "extensions/browser/pref_names.h" |
13 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
14 #include "grit/component_strings.h" | 15 #include "grit/component_strings.h" |
15 #include "policy/policy_constants.h" | 16 #include "policy/policy_constants.h" |
16 | 17 |
17 namespace extensions { | 18 namespace extensions { |
18 | 19 |
19 // ExtensionListPolicyHandler implementation ----------------------------------- | 20 // ExtensionListPolicyHandler implementation ----------------------------------- |
20 | 21 |
21 ExtensionListPolicyHandler::ExtensionListPolicyHandler(const char* policy_name, | 22 ExtensionListPolicyHandler::ExtensionListPolicyHandler(const char* policy_name, |
22 const char* pref_path, | 23 const char* pref_path, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 113 } |
113 | 114 |
114 void ExtensionInstallForcelistPolicyHandler::ApplyPolicySettings( | 115 void ExtensionInstallForcelistPolicyHandler::ApplyPolicySettings( |
115 const policy::PolicyMap& policies, | 116 const policy::PolicyMap& policies, |
116 PrefValueMap* prefs) { | 117 PrefValueMap* prefs) { |
117 const base::Value* value = NULL; | 118 const base::Value* value = NULL; |
118 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 119 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
119 if (CheckAndGetValue(policies, NULL, &value) && | 120 if (CheckAndGetValue(policies, NULL, &value) && |
120 value && | 121 value && |
121 ParseList(value, dict.get(), NULL)) { | 122 ParseList(value, dict.get(), NULL)) { |
122 prefs->SetValue(prefs::kExtensionInstallForceList, dict.release()); | 123 prefs->SetValue(pref_names::kInstallForceList, dict.release()); |
123 } | 124 } |
124 } | 125 } |
125 | 126 |
126 bool ExtensionInstallForcelistPolicyHandler::ParseList( | 127 bool ExtensionInstallForcelistPolicyHandler::ParseList( |
127 const base::Value* policy_value, | 128 const base::Value* policy_value, |
128 base::DictionaryValue* extension_dict, | 129 base::DictionaryValue* extension_dict, |
129 policy::PolicyErrorMap* errors) { | 130 policy::PolicyErrorMap* errors) { |
130 if (!policy_value) | 131 if (!policy_value) |
131 return true; | 132 return true; |
132 | 133 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const policy::PolicyMap& policies, | 239 const policy::PolicyMap& policies, |
239 PrefValueMap* prefs) { | 240 PrefValueMap* prefs) { |
240 if (!pref_path_) | 241 if (!pref_path_) |
241 return; | 242 return; |
242 const base::Value* value = policies.GetValue(policy_name()); | 243 const base::Value* value = policies.GetValue(policy_name()); |
243 if (value) | 244 if (value) |
244 prefs->SetValue(pref_path_, value->DeepCopy()); | 245 prefs->SetValue(pref_path_, value->DeepCopy()); |
245 } | 246 } |
246 | 247 |
247 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |