Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6131)

Unified Diff: chrome/browser/extensions/extension_prefs.cc

Issue 10382149: Refactor the various ways to control what users can do to extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_prefs.cc
===================================================================
--- chrome/browser/extensions/extension_prefs.cc (revision 138227)
+++ chrome/browser/extensions/extension_prefs.cc (working copy)
@@ -21,6 +21,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"
using extensions::Extension;
using extensions::ExtensionInfo;
@@ -659,15 +661,17 @@
Value::CreateBooleanValue(value));
}
-bool ExtensionPrefs::IsExtensionAllowedByPolicy(
- const std::string& extension_id,
- Extension::Location location) const {
- base::StringValue id_value(extension_id);
+std::string ExtensionPrefs::PolicyProviderName() const {
Aaron Boodman 2012/05/22 15:56:11 Methods should typically be verb phrases, so GetPo
+ return "admin policy black/whitelist, via the ExtensionPrefs";
+}
- if (location == Extension::COMPONENT ||
- location == Extension::EXTERNAL_POLICY_DOWNLOAD) {
+bool ExtensionPrefs::UserMayLoad(const extensions::Extension* extension,
+ extensions::Extension::Location location,
+ string16* error) const {
+ base::StringValue id_value(extension->id());
+
+ if (extensions::Extension::IsRequired(location))
Pam (message me for reviews) 2012/05/22 12:51:07 It's a rename (and direction flip) of Extension::U
Aaron Boodman 2012/05/22 15:56:11 Ah. Can that bit be moved into extensions::Managem
Pam (message me for reviews) 2012/05/23 15:00:58 On 2012/05/22 15:56:11, Aaron Boodman wrote: Can
Aaron Boodman 2012/05/24 08:11:23 OK, I see.
return true;
- }
const base::ListValue* blacklist =
prefs_->GetList(prefs::kExtensionInstallDenyList);
@@ -681,8 +685,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 {

Powered by Google App Engine
This is Rietveld 408576698