Index: chrome/browser/extensions/api/permissions/permissions_api.cc |
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc |
index 747a74ee72a85daa3d3a9ee8f977bf1c755fd49d..9fd33141b6cc10820c66aaf91a6a41afee06a739 100644 |
--- a/chrome/browser/extensions/api/permissions/permissions_api.cc |
+++ b/chrome/browser/extensions/api/permissions/permissions_api.cc |
@@ -13,10 +13,15 @@ |
#include "chrome/common/extensions/api/permissions.h" |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/extensions/extension_error_utils.h" |
+#include "chrome/common/extensions/permissions/permissions_info.h" |
#include "chrome/common/extensions/url_pattern_set.h" |
#include "googleurl/src/gurl.h" |
using extensions::api::permissions::Permissions; |
+using extensions::APIPermission; |
+using extensions::APIPermissionSet; |
+using extensions::PermissionSet; |
+using extensions::PermissionsInfo; |
using extensions::PermissionsUpdater; |
namespace Contains = extensions::api::permissions::Contains; |
@@ -49,7 +54,7 @@ bool ignore_user_gesture_for_tests = false; |
bool ContainsPermissionsFunction::RunImpl() { |
scoped_ptr<Contains::Params> params(Contains::Params::Create(*args_)); |
- scoped_refptr<ExtensionPermissionSet> permissions = |
+ scoped_refptr<PermissionSet> permissions = |
helpers::UnpackPermissionSet(params->permissions, &error_); |
if (!permissions.get()) |
return false; |
@@ -70,19 +75,19 @@ bool RemovePermissionsFunction::RunImpl() { |
scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_)); |
EXTENSION_FUNCTION_VALIDATE(params.get()); |
- scoped_refptr<ExtensionPermissionSet> permissions = |
+ scoped_refptr<PermissionSet> permissions = |
helpers::UnpackPermissionSet(params->permissions, &error_); |
if (!permissions.get()) |
return false; |
const extensions::Extension* extension = GetExtension(); |
- ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); |
+ PermissionsInfo* info = PermissionsInfo::GetInstance(); |
// Make sure they're only trying to remove permissions supported by this API. |
- ExtensionAPIPermissionSet apis = permissions->apis(); |
- for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); |
+ APIPermissionSet apis = permissions->apis(); |
+ for (APIPermissionSet::const_iterator i = apis.begin(); |
i != apis.end(); ++i) { |
- const ExtensionAPIPermission* api = info->GetByID(*i); |
+ const APIPermission* api = info->GetByID(*i); |
if (!api->supports_optional()) { |
error_ = ExtensionErrorUtils::FormatErrorMessage( |
kNotWhitelistedError, api->name()); |
@@ -91,9 +96,9 @@ bool RemovePermissionsFunction::RunImpl() { |
} |
// Make sure we don't remove any required pemissions. |
- const ExtensionPermissionSet* required = extension->required_permission_set(); |
- scoped_refptr<ExtensionPermissionSet> intersection( |
- ExtensionPermissionSet::CreateIntersection(permissions.get(), required)); |
+ const PermissionSet* required = extension->required_permission_set(); |
+ scoped_refptr<PermissionSet> intersection( |
+ PermissionSet::CreateIntersection(permissions.get(), required)); |
if (!intersection->IsEmpty()) { |
error_ = kCantRemoveRequiredPermissionsError; |
result_.reset(Remove::Result::Create(false)); |
@@ -151,14 +156,14 @@ bool RequestPermissionsFunction::RunImpl() { |
if (!requested_permissions_.get()) |
return false; |
- ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); |
+ PermissionsInfo* info = PermissionsInfo::GetInstance(); |
ExtensionPrefs* prefs = profile()->GetExtensionService()->extension_prefs(); |
// Make sure they're only requesting permissions supported by this API. |
- ExtensionAPIPermissionSet apis = requested_permissions_->apis(); |
- for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); |
+ APIPermissionSet apis = requested_permissions_->apis(); |
+ for (APIPermissionSet::const_iterator i = apis.begin(); |
i != apis.end(); ++i) { |
- const ExtensionAPIPermission* api = info->GetByID(*i); |
+ const APIPermission* api = info->GetByID(*i); |
if (!api->supports_optional()) { |
error_ = ExtensionErrorUtils::FormatErrorMessage( |
kNotWhitelistedError, api->name()); |
@@ -176,7 +181,7 @@ bool RequestPermissionsFunction::RunImpl() { |
// We don't need to prompt the user if the requested permissions are a subset |
// of the granted permissions set. |
- const ExtensionPermissionSet* granted = |
+ const PermissionSet* granted = |
prefs->GetGrantedPermissions(GetExtension()->id()); |
if (granted && granted->Contains(*requested_permissions_)) { |
PermissionsUpdater perms_updater(profile()); |
@@ -187,7 +192,7 @@ bool RequestPermissionsFunction::RunImpl() { |
} |
// Filter out the granted permissions so we only prompt for new ones. |
- requested_permissions_ = ExtensionPermissionSet::CreateDifference( |
+ requested_permissions_ = PermissionSet::CreateDifference( |
requested_permissions_.get(), granted); |
AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). |