summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_content_browser_client.cc
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 04:56:06 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 04:56:06 +0000
commit44703cc73a24cc39b3e5e832f447d8261701fa4c (patch)
tree79f249332af4fc3613b4f59878233668cbde1908 /chrome/browser/chrome_content_browser_client.cc
parent363e33dcc1b59766434bab7b85f9f9b7ce108237 (diff)
downloadchromium_src-44703cc73a24cc39b3e5e832f447d8261701fa4c.zip
chromium_src-44703cc73a24cc39b3e5e832f447d8261701fa4c.tar.gz
chromium_src-44703cc73a24cc39b3e5e832f447d8261701fa4c.tar.bz2
<webview>: Implement ExecuteScript
This patch implements executeScript for <webview> by using extensions bindings for forwarding requests to the browser process from the app process. The <webview> shim passes the ProcessId and the RouteID of the guest process to the ExecuteScriptFunction object in the browser process. From there, ExecuteScriptFunction grabs the guest web contents, and creates a ScriptExecutor object attached to the guest WebContents. The callback is supported trivially through the extension bindings. When a new guest web contents is created, we inject the Chrome App's extension information into the guest process, so that executeScript knows to bypass permission requests when attempting to execute script within the guest (as suggested by mpcomplete@). BUG=153530 Test=WebViewTest.Shim, webViewExecuteScript Review URL: https://codereview.chromium.org/11968054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_content_browser_client.cc')
-rw-r--r--chrome/browser/chrome_content_browser_client.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 1b6b4d7..f892bd4 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -589,6 +589,24 @@ void ChromeContentBrowserClient::RenderViewHostCreated(
new extensions::MessageHandler(render_view_host);
}
+void ChromeContentBrowserClient::GuestWebContentsCreated(
+ WebContents* guest_web_contents, WebContents* embedder_web_contents) {
+ Profile* profile = Profile::FromBrowserContext(
+ embedder_web_contents->GetBrowserContext());
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ if (!service)
+ return;
+ const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL();
+ const Extension* extension = service->extensions()->
+ GetExtensionOrAppByURL(ExtensionURLInfo(url));
+ if (!extension)
+ return;
+ std::vector<ExtensionMsg_Loaded_Params> extensions;
+ extensions.push_back(ExtensionMsg_Loaded_Params(extension));
+ guest_web_contents->Send(new ExtensionMsg_Loaded(extensions));
+}
+
void ChromeContentBrowserClient::RenderProcessHostCreated(
content::RenderProcessHost* host) {
int id = host->GetID();