Chromium Code Reviews| Index: chrome/browser/extensions/policy_handlers.cc |
| diff --git a/chrome/browser/extensions/policy_handlers.cc b/chrome/browser/extensions/policy_handlers.cc |
| index b0963d63112f7b7dcda894d684b2b4087a90d661..bcf7d518fb7bbabed80d5ee08598089ad6728237 100644 |
| --- a/chrome/browser/extensions/policy_handlers.cc |
| +++ b/chrome/browser/extensions/policy_handlers.cc |
| @@ -99,43 +99,43 @@ bool ExtensionListPolicyHandler::CheckAndGetList( |
| return true; |
| } |
| -// ExtensionInstallForcelistPolicyHandler implementation ----------------------- |
| +// ExtensionInstallListPolicyHandler implementation ---------------------------- |
| -ExtensionInstallForcelistPolicyHandler::ExtensionInstallForcelistPolicyHandler() |
| - : policy::TypeCheckingPolicyHandler(policy::key::kExtensionInstallForcelist, |
| - base::Value::TYPE_LIST) {} |
| +ExtensionInstallListPolicyHandler::ExtensionInstallListPolicyHandler( |
| + const char* policy_name, |
| + const char* pref_name) |
| + : policy::TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_LIST), |
| + pref_name_(pref_name) {} |
| -ExtensionInstallForcelistPolicyHandler:: |
| - ~ExtensionInstallForcelistPolicyHandler() {} |
| +ExtensionInstallListPolicyHandler::~ExtensionInstallListPolicyHandler() {} |
| -bool ExtensionInstallForcelistPolicyHandler::CheckPolicySettings( |
| +bool ExtensionInstallListPolicyHandler::CheckPolicySettings( |
| const policy::PolicyMap& policies, |
| policy::PolicyErrorMap* errors) { |
| const base::Value* value; |
| return CheckAndGetValue(policies, errors, &value) && |
| - ParseList(value, NULL, errors); |
| + ParseList(value, nullptr, errors); |
| } |
| -void ExtensionInstallForcelistPolicyHandler::ApplyPolicySettings( |
| +void ExtensionInstallListPolicyHandler::ApplyPolicySettings( |
| const policy::PolicyMap& policies, |
| PrefValueMap* prefs) { |
| - const base::Value* value = NULL; |
| + const base::Value* value = nullptr; |
| std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| - if (CheckAndGetValue(policies, NULL, &value) && |
| - value && |
| - ParseList(value, dict.get(), NULL)) { |
| - prefs->SetValue(pref_names::kInstallForceList, std::move(dict)); |
| + if (CheckAndGetValue(policies, nullptr, &value) && value && |
| + ParseList(value, dict.get(), nullptr)) { |
| + prefs->SetValue(pref_name(), std::move(dict)); |
| } |
| } |
| -bool ExtensionInstallForcelistPolicyHandler::ParseList( |
| +bool ExtensionInstallListPolicyHandler::ParseList( |
| const base::Value* policy_value, |
| base::DictionaryValue* extension_dict, |
| policy::PolicyErrorMap* errors) { |
| if (!policy_value) |
| return true; |
| - const base::ListValue* policy_list_value = NULL; |
| + const base::ListValue* policy_list_value = nullptr; |
| if (!policy_value->GetAsList(&policy_list_value)) { |
| // This should have been caught in CheckPolicySettings. |
| NOTREACHED(); |
| @@ -167,8 +167,8 @@ bool ExtensionInstallForcelistPolicyHandler::ParseList( |
| continue; |
| } |
| - std::string extension_id = entry_string.substr(0, pos); |
| - std::string update_url = entry_string.substr(pos+1); |
| + const std::string extension_id = entry_string.substr(0, pos); |
| + const std::string update_url = entry_string.substr(pos + 1); |
| if (!crx_file::id_util::IdIsValid(extension_id) || |
| !GURL(update_url).is_valid()) { |
| if (errors) { |
| @@ -180,14 +180,34 @@ bool ExtensionInstallForcelistPolicyHandler::ParseList( |
| } |
| if (extension_dict) { |
| - extensions::ExternalPolicyLoader::AddExtension( |
| - extension_dict, extension_id, update_url); |
| + ExternalPolicyLoader::AddExtension(extension_dict, extension_id, |
| + update_url); |
| } |
| } |
| return true; |
| } |
| +// ExtensionInstallForcelistPolicyHandler implementation ----------------------- |
| + |
| +ExtensionInstallForcelistPolicyHandler::ExtensionInstallForcelistPolicyHandler() |
| + : ExtensionInstallListPolicyHandler(policy::key::kExtensionInstallForcelist, |
| + pref_names::kInstallForceList) {} |
| + |
| +ExtensionInstallForcelistPolicyHandler:: |
| + ~ExtensionInstallForcelistPolicyHandler() {} |
| + |
| +// ExtensionInstallSigninlistPolicyHandler implementation |
| +// ----------------------- |
|
Devlin
2017/03/01 16:15:00
nit: no need for a new line with this.
|
| + |
| +ExtensionInstallSigninListPolicyHandler:: |
| + ExtensionInstallSigninListPolicyHandler() |
| + : ExtensionInstallListPolicyHandler(policy::key::kLoginApps, |
| + pref_names::kInstallSigninList) {} |
| + |
| +ExtensionInstallSigninListPolicyHandler:: |
| + ~ExtensionInstallSigninListPolicyHandler() {} |
| + |
| // ExtensionURLPatternListPolicyHandler implementation ------------------------- |
| ExtensionURLPatternListPolicyHandler::ExtensionURLPatternListPolicyHandler( |