| Index: chrome/browser/extensions/policy_handlers.cc
|
| diff --git a/chrome/browser/extensions/policy_handlers.cc b/chrome/browser/extensions/policy_handlers.cc
|
| index fa8015808ffdd7f56d3dc2106a2424ab500ba40f..8ee0bee34a419ddb771c3fac97b844ef885f3385 100644
|
| --- a/chrome/browser/extensions/policy_handlers.cc
|
| +++ b/chrome/browser/extensions/policy_handlers.cc
|
| @@ -99,43 +99,41 @@ bool ExtensionListPolicyHandler::CheckAndGetList(
|
| return true;
|
| }
|
|
|
| -// ExtensionInstallForcelistPolicyHandler implementation -----------------------
|
| -
|
| -ExtensionInstallForcelistPolicyHandler::ExtensionInstallForcelistPolicyHandler()
|
| - : policy::TypeCheckingPolicyHandler(policy::key::kExtensionInstallForcelist,
|
| - base::Value::Type::LIST) {}
|
| +// ExtensionInstallListPolicyHandler implementation ----------------------------
|
|
|
| -ExtensionInstallForcelistPolicyHandler::
|
| - ~ExtensionInstallForcelistPolicyHandler() {}
|
| +ExtensionInstallListPolicyHandler::ExtensionInstallListPolicyHandler(
|
| + const char* policy_name,
|
| + const char* pref_name)
|
| + : policy::TypeCheckingPolicyHandler(policy_name, base::Value::Type::LIST),
|
| + pref_name_(pref_name) {}
|
|
|
| -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 +165,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 +178,28 @@ 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) {}
|
| +
|
| +// ExtensionInstallLoginScreenAppListPolicyHandler implementation --------------
|
| +
|
| +ExtensionInstallLoginScreenAppListPolicyHandler::
|
| + ExtensionInstallLoginScreenAppListPolicyHandler()
|
| + : ExtensionInstallListPolicyHandler(
|
| + policy::key::kDeviceLoginScreenAppInstallList,
|
| + pref_names::kInstallLoginScreenAppList) {}
|
| +
|
| // ExtensionURLPatternListPolicyHandler implementation -------------------------
|
|
|
| ExtensionURLPatternListPolicyHandler::ExtensionURLPatternListPolicyHandler(
|
|
|