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

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

Issue 7003098: Start refractoring extension permissions into ExtensionPermissionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a bad merge Created 9 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index a835f6a70886f0407638539606d0cc47866f14ad..4f66c0e289c26fec8d3c45bd0ef8cbd53a624239 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -907,9 +907,7 @@ void ExtensionService::GrantPermissions(const Extension* extension) {
URLPatternSet effective_hosts = extension->GetEffectiveHostPermissions();
extension_prefs_->AddGrantedPermissions(extension->id(),
- extension->HasFullPermissions(),
- extension->api_permissions(),
- effective_hosts);
+ extension->permission_set());
}
void ExtensionService::GrantPermissionsAndEnableExtension(
@@ -1127,16 +1125,16 @@ void ExtensionService::RecordPermissionMessagesHistogram(
base::Histogram* counter = base::LinearHistogram::FactoryGet(
histogram,
1,
- Extension::PermissionMessage::ID_ENUM_BOUNDARY,
- Extension::PermissionMessage::ID_ENUM_BOUNDARY + 1,
+ ExtensionPermissionMessage::ID_ENUM_BOUNDARY,
+ ExtensionPermissionMessage::ID_ENUM_BOUNDARY + 1,
base::Histogram::kUmaTargetedHistogramFlag);
- std::vector<Extension::PermissionMessage> permissions =
+ std::vector<ExtensionPermissionMessage> permissions =
e->GetPermissionMessages();
if (permissions.empty()) {
- counter->Add(Extension::PermissionMessage::ID_NONE);
+ counter->Add(ExtensionPermissionMessage::ID_NONE);
} else {
- std::vector<Extension::PermissionMessage>::iterator it;
+ std::vector<ExtensionPermissionMessage>::iterator it;
for (it = permissions.begin(); it != permissions.end(); ++it)
counter->Add(it->message_id());
}
@@ -1839,10 +1837,6 @@ void ExtensionService::DisableIfPrivilegeIncrease(const Extension* extension) {
// can upgrade without requiring this user's approval.
const Extension* old = GetExtensionByIdInternal(extension->id(),
true, true, false);
- bool granted_full_access;
- std::set<std::string> granted_apis;
- URLPatternSet granted_extent;
-
bool is_extension_upgrade = old != NULL;
bool is_privilege_increase = false;
@@ -1851,23 +1845,22 @@ void ExtensionService::DisableIfPrivilegeIncrease(const Extension* extension) {
if (extension->location() == Extension::INTERNAL) {
// Add all the recognized permissions if the granted permissions list
// hasn't been initialized yet.
- if (!extension_prefs_->GetGrantedPermissions(extension->id(),
- &granted_full_access,
- &granted_apis,
- &granted_extent)) {
+ bool initialized = false;
+ scoped_ptr<ExtensionPermissionSet> granted_permissions(
+ extension_prefs_->GetGrantedPermissions(extension->id(), &initialized));
+ if (!initialized) {
GrantPermissions(extension);
- CHECK(extension_prefs_->GetGrantedPermissions(extension->id(),
- &granted_full_access,
- &granted_apis,
- &granted_extent));
+ granted_permissions.reset(
+ extension_prefs_->GetGrantedPermissions(extension->id(), NULL));
+ CHECK(granted_permissions.get());
}
// Here, we check if an extension's privileges have increased in a manner
// that requires the user's approval. This could occur because the browser
// upgraded and recognized additional privileges, or an extension upgrades
// to a version that requires additional privileges.
- is_privilege_increase = Extension::IsPrivilegeIncrease(
- granted_full_access, granted_apis, granted_extent, extension);
+ is_privilege_increase =
+ granted_permissions->HasLessPrivilegesThan(extension->permission_set());
}
if (is_extension_upgrade) {

Powered by Google App Engine
This is Rietveld 408576698