| Index: chrome/renderer/extensions/custom_bindings_util.cc
|
| diff --git a/chrome/renderer/extensions/custom_bindings_util.cc b/chrome/renderer/extensions/custom_bindings_util.cc
|
| index 352f7015e9852eaa8710ca2a83e34e1f9203dfad..d00324b0beb5dd120690f91b94f37104d9f939d3 100644
|
| --- a/chrome/renderer/extensions/custom_bindings_util.cc
|
| +++ b/chrome/renderer/extensions/custom_bindings_util.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/string_util.h"
|
| #include "chrome/common/extensions/api/extension_api.h"
|
| #include "chrome/common/extensions/extension.h"
|
| +#include "chrome/renderer/extensions/app_bindings.h"
|
| #include "chrome/renderer/extensions/chrome_v8_extension.h"
|
| #include "chrome/renderer/extensions/chrome_private_custom_bindings.h"
|
| #include "chrome/renderer/extensions/context_menus_custom_bindings.h"
|
| @@ -72,6 +73,8 @@ std::vector<v8::Extension*> GetAll(ExtensionDispatcher* extension_dispatcher) {
|
| std::vector<v8::Extension*> result;
|
|
|
| // Custom bindings that have native code parts.
|
| + result.push_back(new AppBindings(
|
| + kDependencyCount, kDependencies, extension_dispatcher));
|
| result.push_back(new ChromePrivateCustomBindings(
|
| kDependencyCount, kDependencies, extension_dispatcher));
|
| result.push_back(new ContextMenusCustomBindings(
|
| @@ -149,7 +152,7 @@ std::string GetAPIName(const std::string& v8_extension_name) {
|
|
|
| bool AllowAPIInjection(const std::string& api_name,
|
| const Extension& extension,
|
| - ExtensionDispatcher* extension_dispatcher) {
|
| + ChromeV8Context::ContextType context_type) {
|
| CHECK(api_name != "");
|
|
|
| // As in ExtensionAPI::GetSchemasForExtension, we need to allow any bindings
|
| @@ -158,12 +161,20 @@ bool AllowAPIInjection(const std::string& api_name,
|
| extension.required_permission_set()->HasAnyAccessToAPI(api_name) ||
|
| extension.optional_permission_set()->HasAnyAccessToAPI(api_name);
|
|
|
| - if (extension_dispatcher->is_extension_process()) {
|
| - return allowed;
|
| - } else {
|
| - return allowed &&
|
| - !ExtensionAPI::GetInstance()->IsWholeAPIPrivileged(api_name);
|
| + switch (context_type) {
|
| + case ChromeV8Context::PRIVILEGED:
|
| + return allowed;
|
| +
|
| + case ChromeV8Context::CONTENT_SCRIPT:
|
| + case ChromeV8Context::UNPRIVILEGED:
|
| + return allowed &&
|
| + !ExtensionAPI::GetInstance()->IsWholeAPIPrivileged(api_name);
|
| +
|
| + case ChromeV8Context::WEB_PAGE:
|
| + NOTREACHED();
|
| }
|
| +
|
| + return false;
|
| }
|
|
|
| } // namespace custom_bindings_util
|
|
|