Decouple GuestView creation from attachment.
This enables attaching the GuestView earlier on prior to loading resources.
Loading events that occur prior to attachment
are queued until attachment and then sent to the embedder on attachment.
This CL also moves loadstop from content to chrome. Existing tests exercise the need for queuing.
BUG=166165
Test=WebViewTest.Shim (newwindow tests)
Review URL: https://chromiumcodereview.appspot.com/17624004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209345 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 4ca75b4..27ce609 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -423,13 +423,14 @@
BrowserPluginGuest* WebContentsImpl::CreateGuest(
BrowserContext* browser_context,
SiteInstance* site_instance,
- int guest_instance_id) {
+ int guest_instance_id,
+ scoped_ptr<base::DictionaryValue> extra_params) {
WebContentsImpl* new_contents = new WebContentsImpl(browser_context, NULL);
// This makes |new_contents| act as a guest.
// For more info, see comment above class BrowserPluginGuest.
- new_contents->browser_plugin_guest_.reset(
- BrowserPluginGuest::Create(guest_instance_id, new_contents));
+ BrowserPluginGuest::Create(
+ guest_instance_id, new_contents, extra_params.Pass());
WebContents::CreateParams create_params(browser_context, site_instance);
new_contents->Init(create_params);
@@ -1492,9 +1493,8 @@
int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id();
WebContentsImpl* new_contents_impl =
static_cast<WebContentsImpl*>(new_contents);
- new_contents_impl->browser_plugin_guest_.reset(
- BrowserPluginGuest::CreateWithOpener(instance_id, new_contents_impl,
- GetBrowserPluginGuest(), !!new_contents_impl->opener()));
+ BrowserPluginGuest::CreateWithOpener(instance_id, new_contents_impl,
+ GetBrowserPluginGuest(), !!new_contents_impl->opener());
}
new_contents->Init(create_params);
@@ -3674,6 +3674,11 @@
return browser_plugin_guest_.get();
}
+void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) {
+ CHECK(!browser_plugin_guest_);
+ browser_plugin_guest_.reset(guest);
+}
+
BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const {
return browser_plugin_embedder_.get();
}