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

Unified Diff: chrome/common/extensions/extension.cc

Issue 2846034: Split out the bookmark permission into its own line in ExtensionInstallUI. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 6 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 3631af0ca58c4e518efa4447fe555b98af435a7e..c83f3c8347e628c77fe26a6a226c8e4c2172412f 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -32,6 +32,7 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
#include "webkit/glue/image_decoder.h"
#if defined(OS_WIN)
@@ -146,6 +147,19 @@ const char* Extension::kPermissionNames[] = {
const size_t Extension::kNumPermissions =
arraysize(Extension::kPermissionNames);
+const Extension::SimplePermissions& Extension::GetSimplePermissions() {
+ static SimplePermissions permissions;
+ if (permissions.empty()) {
+ permissions[Extension::kBookmarkPermission] =
+ l10n_util::GetStringUTF16(
+ IDS_EXTENSION_PROMPT2_WARNING_BOOKMARKS);
+ permissions[Extension::kGeolocationPermission] =
+ l10n_util::GetStringUTF16(
+ IDS_EXTENSION_PROMPT2_WARNING_GEOLOCATION);
+ }
+ return permissions;
+}
+
Extension::~Extension() {
}
@@ -874,12 +888,20 @@ bool Extension::IsPrivilegeIncrease(Extension* old_extension,
return true;
}
- // If we're going from not having history to not having it, it's an increase.
if (!old_extension->HasEffectiveBrowsingHistoryPermission() &&
new_extension->HasEffectiveBrowsingHistoryPermission()) {
return true;
}
+ const SimplePermissions& simple_permissions = GetSimplePermissions();
+ for (SimplePermissions::const_iterator iter = simple_permissions.begin();
+ iter != simple_permissions.end(); ++iter) {
+ if (!old_extension->HasApiPermission(iter->first) &&
+ new_extension->HasApiPermission(iter->first)) {
+ return true;
+ }
+ }
+
// Nothing much has changed.
return false;
}
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698