Chromium Code Reviews| Index: chrome/browser/extensions/extension_prefs.cc |
| =================================================================== |
| --- chrome/browser/extensions/extension_prefs.cc (revision 136836) |
| +++ chrome/browser/extensions/extension_prefs.cc (working copy) |
| @@ -20,6 +20,8 @@ |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| #include "content/public/browser/notification_service.h" |
| +#include "grit/generated_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| namespace { |
| @@ -651,15 +653,14 @@ |
| Value::CreateBooleanValue(value)); |
| } |
| -bool ExtensionPrefs::IsExtensionAllowedByPolicy( |
| - const std::string& extension_id, |
| - Extension::Location location) const { |
| +bool ExtensionPrefs::UserMayInstall(const std::string& extension_id, |
| + Extension::Location location, |
| + const std::string& extension_name, |
| + string16* error) const { |
| base::StringValue id_value(extension_id); |
| - if (location == Extension::COMPONENT || |
| - location == Extension::EXTERNAL_POLICY_DOWNLOAD) { |
| + if (Extension::IsRequired(location)) |
|
Aaron Boodman
2012/05/17 22:41:06
I don't see any Extension::IsRequired. What's this
Pam (message me for reviews)
2012/05/18 20:15:15
It's a rename (and direction flip) of Extension::U
|
| return true; |
| - } |
| const base::ListValue* blacklist = |
| prefs_->GetList(prefs::kExtensionInstallDenyList); |
| @@ -673,8 +674,15 @@ |
| return true; |
| // Then check the blacklist (the admin blacklist, not the Google blacklist). |
| - return blacklist->Find(id_value) == blacklist->end() && |
| - !ExtensionsBlacklistedByDefault(); |
| + bool result = blacklist->Find(id_value) == blacklist->end() && |
| + !ExtensionsBlacklistedByDefault(); |
| + if (error && !result) { |
| + *error = l10n_util::GetStringFUTF16( |
| + IDS_EXTENSION_CANT_INSTALL_POLICY_BLACKLIST, |
| + UTF8ToUTF16(extension_name), |
| + UTF8ToUTF16(extension_id)); |
| + } |
| + return result; |
| } |
| bool ExtensionPrefs::ExtensionsBlacklistedByDefault() const { |