| Index: chrome/renderer/extensions/chrome_v8_extension.cc
|
| diff --git a/chrome/renderer/extensions/chrome_v8_extension.cc b/chrome/renderer/extensions/chrome_v8_extension.cc
|
| index 791b1f533c9a7b35e5d9c6615db39e4d86628f73..5e6a2ba7fc910d760ccec135bdb223ecc3a8f2cc 100644
|
| --- a/chrome/renderer/extensions/chrome_v8_extension.cc
|
| +++ b/chrome/renderer/extensions/chrome_v8_extension.cc
|
| @@ -80,38 +80,6 @@ const Extension* ChromeV8Extension::GetExtensionForCurrentRenderView() const {
|
|
|
| bool ChromeV8Extension::CheckCurrentContextAccessToExtensionAPI(
|
| const std::string& function_name) const {
|
| - ChromeV8Context* context =
|
| - extension_dispatcher_->v8_context_set().GetCurrent();
|
| - if (!context) {
|
| - DLOG(ERROR) << "Not in a v8::Context";
|
| - return false;
|
| - }
|
| -
|
| - const ::Extension* extension = NULL;
|
| - if (!context->extension_id().empty()) {
|
| - extension =
|
| - extension_dispatcher_->extensions()->GetByID(context->extension_id());
|
| - }
|
| -
|
| - if (!extension || !extension->HasAPIPermission(function_name)) {
|
| - static const char kMessage[] =
|
| - "You do not have permission to use '%s'. Be sure to declare"
|
| - " in your manifest what permissions you need.";
|
| - std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
|
| - v8::ThrowException(
|
| - v8::Exception::Error(v8::String::New(error_msg.c_str())));
|
| - return false;
|
| - }
|
| -
|
| - if (!extension_dispatcher_->IsExtensionActive(extension->id()) &&
|
| - ExtensionAPI::GetInstance()->IsPrivileged(function_name)) {
|
| - static const char kMessage[] =
|
| - "%s can only be used in an extension process.";
|
| - std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
|
| - v8::ThrowException(
|
| - v8::Exception::Error(v8::String::New(error_msg.c_str())));
|
| - return false;
|
| - }
|
| -
|
| - return true;
|
| + return extension_dispatcher_->CheckCurrentContextAccessToExtensionAPI(
|
| + function_name);
|
| }
|
|
|