summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_embedder.cc
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-05 08:45:46 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-05 08:45:46 +0000
commit44295a1e74ee1a6b0928bb552e36f7b8ce55b881 (patch)
treeaf644446d6f2da6339068a9837557e8e65f7ccdf /content/browser/browser_plugin/browser_plugin_embedder.cc
parent8f3bcbd090e445d1b72ab2b9aea3f5d954311e49 (diff)
downloadchromium_src-44295a1e74ee1a6b0928bb552e36f7b8ce55b881.zip
chromium_src-44295a1e74ee1a6b0928bb552e36f7b8ce55b881.tar.gz
chromium_src-44295a1e74ee1a6b0928bb552e36f7b8ce55b881.tar.bz2
<webview> WebRequest API tied to webview instance ID instead of guest instance ID
This permits installing WebRequest API listeners prior to initial navigation and prior to attachment. BUG=171421 Test=WebViewInteractiveTest.NewWindow Review URL: https://chromiumcodereview.appspot.com/15894014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index fd79974..9f5a8bb 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -13,6 +13,7 @@
#include "content/common/drag_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
@@ -166,15 +167,33 @@ void BrowserPluginEmbedder::OnAttach(
GetBrowserPluginGuestManager()->GetGuestByInstanceID(
instance_id, web_contents()->GetRenderProcessHost()->GetID());
+
if (guest) {
+ // On attachment, GuestWebContentsAttached needs to be called first to make
+ // the BrowserPlugin to guest association prior to resource loads to allow
+ // APIs to intercept and associate resource loads with a particular
+ // BrowserPlugin.
+ GetContentClient()->browser()->GuestWebContentsAttached(
+ guest->GetWebContents(),
+ web_contents(),
+ params.browser_plugin_instance_id);
+
guest->Attach(static_cast<WebContentsImpl*>(web_contents()), params);
return;
}
guest = GetBrowserPluginGuestManager()->CreateGuest(
web_contents()->GetSiteInstance(), instance_id, params);
- if (guest)
+ if (guest) {
guest->Initialize(static_cast<WebContentsImpl*>(web_contents()), params);
+ // On creation, GuestWebContentsAttached cannot be called until after
+ // initialization because there is no process to send a message to until
+ // the guest is initialized.
+ GetContentClient()->browser()->GuestWebContentsAttached(
+ guest->GetWebContents(),
+ web_contents(),
+ params.browser_plugin_instance_id);
+ }
}
void BrowserPluginEmbedder::OnPluginAtPositionResponse(