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

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

Issue 9694038: OBSOLETE REVIEW. See http://codereview.chromium.org/10382149/ (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_management_api.cc
===================================================================
--- chrome/browser/extensions/extension_management_api.cc (revision 136836)
+++ chrome/browser/extensions/extension_management_api.cc (working copy)
@@ -58,6 +58,9 @@
bool enabled = service->IsExtensionEnabled(extension.id());
extension.GetBasicInfo(enabled, info);
+ info->SetBoolean(keys::kMayDisableKey, service->
Aaron Boodman 2012/05/17 22:41:06 What's the need for this?
Aaron Boodman 2012/05/17 22:41:06 Wrapping: param lines should all start at same col
Pam (message me for reviews) 2012/05/18 20:15:15 It's part of the ExtensionInfo returned by the API
+ extension_management_policy()->UserMayModifyStatus(&extension, NULL));
+
info->SetBoolean(keys::kIsAppKey, extension.is_app());
if (!enabled) {
@@ -365,9 +368,15 @@
return false;
}
- if (!Extension::UserMayDisable(extension->location())) {
- error_ = ExtensionErrorUtils::FormatErrorMessage(
- keys::kUserCantDisableError, extension_id_);
+ if (!service()->extension_management_policy()->
+ UserMayModifyStatus(extension, NULL)) {
+ if (enable) {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kUserCantModifyError, extension_id_);
Aaron Boodman 2012/05/17 22:41:06 Can we just have a generic kUserCantDoAnything err
Pam (message me for reviews) 2012/05/18 20:15:15 Excellent, I'd love to consolidate them.
+ } else {
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
+ keys::kUserCantDisableError, extension_id_);
+ }
return false;
}
@@ -420,10 +429,9 @@
return false;
}
- ExtensionPrefs* prefs = service()->extension_prefs();
-
- if (!Extension::UserMayDisable(
- prefs->GetInstalledExtensionInfo(extension_id)->extension_location)) {
+ const Extension* extension = service()->GetExtensionById(extension_id, true);
+ if (!service()->extension_management_policy()->
+ UserMayModifyStatus(extension, NULL)) {
Aaron Boodman 2012/05/17 22:41:06 Wrap at open paren. You should also change extensi
error_ = ExtensionErrorUtils::FormatErrorMessage(
keys::kUserCantDisableError, extension_id);
return false;

Powered by Google App Engine
This is Rietveld 408576698