summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc3
-rw-r--r--chrome/browser/extensions/content_script_all_frames_apitest.cc5
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc21
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.h4
-rw-r--r--chrome/browser/extensions/extension_host.cc3
-rw-r--r--chrome/browser/extensions/extension_messages_browsertest.cc7
-rw-r--r--chrome/browser/extensions/extensions_service.cc12
-rw-r--r--chrome/browser/extensions/extensions_service.h5
8 files changed, 9 insertions, 51 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 689a88c..1ca01cc 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -86,9 +86,10 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
// The extension should have opened 3 new tabs. Including the original blank
// tab, we now have 4 tabs. Two should be part of the extension app, and
- // grouped in the same process.
+ // grouped in the extension process.
ASSERT_EQ(4, browser()->tab_count());
RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
+ EXPECT_TRUE(host->is_extension_process());
EXPECT_EQ(host->process(),
browser()->GetTabContentsAt(2)->render_view_host()->process());
diff --git a/chrome/browser/extensions/content_script_all_frames_apitest.cc b/chrome/browser/extensions/content_script_all_frames_apitest.cc
index 3ed2f05..fac6362 100644
--- a/chrome/browser/extensions/content_script_all_frames_apitest.cc
+++ b/chrome/browser/extensions/content_script_all_frames_apitest.cc
@@ -9,10 +9,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAllFrames) {
ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_;
}
-// TODO(rafaelw): This test now fails because non-extension processes do not
-// get extension bindings setup by scheme. Fixing crbug.com/53610 will fix this.
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
- DISABLED_ContentScriptExtensionIframe) {
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionIframe) {
ASSERT_TRUE(test_server()->Start());
ASSERT_TRUE(RunExtensionTest("content_scripts/extension_iframe")) << message_;
}
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index a8253cf..51cc8fe 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -333,13 +333,7 @@ ExtensionFunctionDispatcher* ExtensionFunctionDispatcher::Create(
render_view_host->process()->profile()->GetExtensionsService();
DCHECK(service);
- if (!service->ExtensionBindingsAllowed(url))
- return NULL;
-
Extension* extension = service->GetExtensionByURL(url);
- if (!extension)
- extension = service->GetExtensionByWebExtent(url);
-
if (extension)
return new ExtensionFunctionDispatcher(render_view_host, delegate,
extension, url);
@@ -356,12 +350,10 @@ ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
render_view_host_(render_view_host),
delegate_(delegate),
url_(url),
- extension_id_(extension->id()),
ALLOW_THIS_IN_INITIALIZER_LIST(peer_(new Peer(this))) {
// TODO(erikkay) should we do something for these errors in Release?
+ DCHECK(url.SchemeIs(chrome::kExtensionScheme));
DCHECK(extension);
- DCHECK(url.SchemeIs(chrome::kExtensionScheme) ||
- extension->location() == Extension::COMPONENT);
// Notify the ExtensionProcessManager that the view was created.
ExtensionProcessManager* epm = profile()->GetExtensionProcessManager();
@@ -456,17 +448,6 @@ void ExtensionFunctionDispatcher::HandleRequest(
DCHECK(extension);
function->set_include_incognito(service->IsIncognitoEnabled(extension));
- std::string permission_name = function->name();
- size_t separator = permission_name.find_first_of("./");
- if (separator != std::string::npos)
- permission_name = permission_name.substr(0, separator);
-
- if (!service->ExtensionBindingsAllowed(function->source_url()) ||
- !extension->HasApiPermission(permission_name)) {
- render_view_host_->BlockExtensionRequest(function->request_id());
- return;
- }
-
ExtensionsQuotaService* quota = service->quota_service();
if (quota->Assess(extension_id(), function, &params.arguments,
base::TimeTicks::Now())) {
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h
index 2e8251f..9bddecf 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.h
+++ b/chrome/browser/extensions/extension_function_dispatcher.h
@@ -114,7 +114,7 @@ class ExtensionFunctionDispatcher {
const GURL& url() { return url_; }
// Gets the ID for this extension.
- const std::string extension_id() { return extension_id_; }
+ const std::string extension_id() { return url_.host(); }
// The profile that this dispatcher is associated with.
Profile* profile();
@@ -139,8 +139,6 @@ class ExtensionFunctionDispatcher {
GURL url_;
- std::string extension_id_;
-
scoped_refptr<Peer> peer_;
// AutomationExtensionFunction requires access to the RenderViewHost
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index f43501b..1c1a675 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -513,8 +513,7 @@ void ExtensionHost::CreateNewWindow(
route_id,
render_view_host()->process()->profile(),
site_instance(),
- DOMUIFactory::GetDOMUIType(render_view_host()->process()->profile(),
- url_),
+ DOMUIFactory::GetDOMUIType(url_),
this,
window_container_type,
frame_name);
diff --git a/chrome/browser/extensions/extension_messages_browsertest.cc b/chrome/browser/extensions/extension_messages_browsertest.cc
index 5e78c79..3b3c273 100644
--- a/chrome/browser/extensions/extension_messages_browsertest.cc
+++ b/chrome/browser/extensions/extension_messages_browsertest.cc
@@ -16,11 +16,8 @@ static void DispatchOnConnect(int source_port_id, const std::string& name,
args.Set(0, Value::CreateIntegerValue(source_port_id));
args.Set(1, Value::CreateStringValue(name));
args.Set(2, Value::CreateStringValue(tab_json));
- // Testing extensionId. Set in EventBindings::HandleContextCreated.
- // We use the same id for source & target to similute an extension "talking
- // to itself".
- args.Set(3, Value::CreateStringValue(EventBindings::kTestingExtensionId));
- args.Set(4, Value::CreateStringValue(EventBindings::kTestingExtensionId));
+ args.Set(3, Value::CreateStringValue("")); // extension ID is empty for tests
+ args.Set(4, Value::CreateStringValue("")); // extension ID is empty for tests
RendererExtensionBindings::Invoke(
ExtensionMessageService::kDispatchOnConnect, args, NULL, false, GURL());
}
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 815ee49..3fb4a91 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -533,7 +533,7 @@ void ExtensionsService::LoadComponentExtensions() {
// In order for the --apps-gallery-url switch to work with the gallery
// process isolation, we must insert any provided value into the component
// app's launch url and web extent.
- if (extension->id() == extension_misc::kWebStoreAppId) {
+ if (extension->id() == extension_misc::kWebStoreAppId ) {
GURL gallery_url(CommandLine::ForCurrentProcess()
->GetSwitchValueASCII(switches::kAppsGalleryURL));
if (gallery_url.is_valid()) {
@@ -1255,16 +1255,6 @@ Extension* ExtensionsService::GetExtensionByWebExtent(const GURL& url) {
return NULL;
}
-bool ExtensionsService::ExtensionBindingsAllowed(const GURL& url) {
- // Allow bindings for all packaged extension.
- if (GetExtensionByURL(url))
- return true;
-
- // Allow bindings for all component, hosted apps.
- Extension* extension = GetExtensionByWebExtent(url);
- return (extension && extension->location() == Extension::COMPONENT);
-}
-
Extension* ExtensionsService::GetExtensionByOverlappingWebExtent(
const ExtensionExtent& extent) {
for (size_t i = 0; i < extensions_.size(); ++i) {
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index efdc17b..45110d4 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -288,11 +288,6 @@ class ExtensionsService
// extent, if one exists.
Extension* GetExtensionByOverlappingWebExtent(const ExtensionExtent& extent);
- // Returns true if |url| should get extension api bindings and be permitted
- // to make api calls. Note that this is independent of what extension
- // permissions the given extension has been granted.
- bool ExtensionBindingsAllowed(const GURL& url);
-
// Returns the icon to display in the omnibox for the given extension.
const SkBitmap& GetOmniboxIcon(const std::string& extension_id);