Browser Plugin: Refactor BrowserPluginEmbedder to allow creating guests with openers
Changes:
1. Move most of logic in BrowserPluginEmbedder:OnCreateGuest to BrowserPluginEmbedder::CreateGuest. BrowserPluginEmbedder::CreateGuest takes in an opener guest and a routing ID. BrowserPluginEmbedder::OnCreateGuest calls CreateGuest with a NULL opener.
2. WebContentsImpl::CreateGuest now takes in a routing_id, and a base_web_contents.
3. WebContentsImpl::opener() is now a public accessor.
4. BrowserPluginEmbedder::GetGuestByInstanceID and BrowserPluginEmbedder::DestroyGuestByInstanceID are now public to allow a guest to take (temporary) "ownership" of another guest until it is attached to the embedder's DOM tree.
BUG=140316
Review URL: https://codereview.chromium.org/11748034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175588 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index e7a25895..310bca3 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -85,10 +85,16 @@
const WebContents::CreateParams& params,
WebContentsImpl* opener);
+ // Returns the opener WebContentsImpl, if any. This can be set to null if the
+ // opener is closed or the page clears its window.opener.
+ WebContentsImpl* opener() const { return opener_; }
+
// Creates a WebContents to be used as a browser plugin guest.
static WebContentsImpl* CreateGuest(
BrowserContext* browser_context,
content::SiteInstance* site_instance,
+ int routing_id,
+ WebContentsImpl* opener_web_contents,
int guest_instance_id,
const BrowserPluginHostMsg_CreateGuest_Params& params);