| Index: chrome/common/extensions/extension.cc
|
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
|
| index 04475081a52ddc8d892092fde25f1caeb48a4a19..a3e12361ec8bba68f3be38375a4a6ab60255ee62 100644
|
| --- a/chrome/common/extensions/extension.cc
|
| +++ b/chrome/common/extensions/extension.cc
|
| @@ -2835,12 +2835,23 @@ bool Extension::ImplicitlyDelaysNetworkStartup() const {
|
| bool Extension::CanSpecifyAPIPermission(
|
| const ExtensionAPIPermission* permission,
|
| string16* error) const {
|
| - if (permission->is_component_only()) {
|
| - if (!CanSpecifyComponentOnlyPermission()) {
|
| - *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
|
| - errors::kPermissionNotAllowed, permission->name());
|
| - return false;
|
| - }
|
| + if (location_ == Extension::COMPONENT)
|
| + return true;
|
| +
|
| + bool access_denied = false;
|
| + if (permission->HasWhitelist()) {
|
| + if (permission->IsWhitelisted(id_))
|
| + return true;
|
| + else
|
| + access_denied = true;
|
| + } else if (permission->is_component_only()) {
|
| + access_denied = true;
|
| + }
|
| +
|
| + if (access_denied) {
|
| + *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
|
| + errors::kPermissionNotAllowed, permission->name());
|
| + return false;
|
| }
|
|
|
| if (permission->id() == ExtensionAPIPermission::kExperimental) {
|
| @@ -2850,9 +2861,6 @@ bool Extension::CanSpecifyAPIPermission(
|
| }
|
| }
|
|
|
| - if (location_ == Extension::COMPONENT)
|
| - return true;
|
| -
|
| bool supports_type = false;
|
| switch (GetType()) {
|
| case TYPE_USER_SCRIPT: // Pass through.
|
| @@ -2892,13 +2900,6 @@ bool Extension::CanSpecifyAPIPermission(
|
| return true;
|
| }
|
|
|
| -bool Extension::CanSpecifyComponentOnlyPermission() const {
|
| - // Only COMPONENT extensions can use private APIs.
|
| - // TODO(asargent) - We want a more general purpose mechanism for this,
|
| - // and better error messages. (http://crbug.com/54013)
|
| - return location_ == Extension::COMPONENT;
|
| -}
|
| -
|
| bool Extension::CanSpecifyExperimentalPermission() const {
|
| if (location_ == Extension::COMPONENT)
|
| return true;
|
|
|