diff options
author | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 14:37:38 +0000 |
---|---|---|
committer | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 14:37:38 +0000 |
commit | 70d4450270d54a051b3b5ea828814ced1c29857f (patch) | |
tree | 423a9efae232deb702ed06d34f79b72a3ec1986e | |
parent | ee129ac14287e4710d822dec833a20a42f537f9e (diff) | |
download | chromium_src-70d4450270d54a051b3b5ea828814ced1c29857f.zip chromium_src-70d4450270d54a051b3b5ea828814ced1c29857f.tar.gz chromium_src-70d4450270d54a051b3b5ea828814ced1c29857f.tar.bz2 |
BrowserPlugin: Simplify content/public API
BUG=364141, 330264
Review URL: https://codereview.chromium.org/264943006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268753 0039d316-1c4b-4281-b951-d872f2087c98
12 files changed, 185 insertions, 154 deletions
diff --git a/chrome/browser/guest_view/guest_view_base.cc b/chrome/browser/guest_view/guest_view_base.cc index 80526d5..a9bcbbf 100644 --- a/chrome/browser/guest_view/guest_view_base.cc +++ b/chrome/browser/guest_view/guest_view_base.cc @@ -87,7 +87,7 @@ GuestViewBase* GuestViewBase::From(int embedder_process_id, content::WebContents* guest_web_contents = GuestViewManager::FromBrowserContext(host->GetBrowserContext())-> - GetGuestByInstanceID(guest_instance_id, embedder_process_id); + GetGuestByInstanceIDSafely(guest_instance_id, embedder_process_id); if (!guest_web_contents) return NULL; diff --git a/chrome/browser/guest_view/guest_view_manager.cc b/chrome/browser/guest_view/guest_view_manager.cc index 1e07de1..a1aaf5f 100644 --- a/chrome/browser/guest_view/guest_view_manager.cc +++ b/chrome/browser/guest_view/guest_view_manager.cc @@ -75,6 +75,16 @@ GuestViewManager* GuestViewManager::FromBrowserContext( return guest_manager; } +content::WebContents* GuestViewManager::GetGuestByInstanceIDSafely( + int guest_instance_id, + int embedder_render_process_id) { + if (!CanEmbedderAccessInstanceIDMaybeKill(embedder_render_process_id, + guest_instance_id)) { + return NULL; + } + return GetGuestByInstanceID(guest_instance_id, embedder_render_process_id); +} + int GuestViewManager::GetNextInstanceID() { return ++current_instance_id_; } @@ -97,13 +107,53 @@ void GuestViewManager::RemoveGuest(int guest_instance_id) { guest_web_contents_by_instance_id_.erase(it); } -content::WebContents* GuestViewManager::GetGuestByInstanceID( +void GuestViewManager::MaybeGetGuestByInstanceIDOrKill( int guest_instance_id, - int embedder_render_process_id) { + int embedder_render_process_id, + const GuestByInstanceIDCallback& callback) { if (!CanEmbedderAccessInstanceIDMaybeKill(embedder_render_process_id, guest_instance_id)) { - return NULL; + // If we kill the embedder, then don't bother calling back. + return; } + content::WebContents* guest_web_contents = + GetGuestByInstanceID(guest_instance_id, embedder_render_process_id); + callback.Run(guest_web_contents); +} + +SiteInstance* GuestViewManager::GetGuestSiteInstance( + const GURL& guest_site) { + for (GuestInstanceMap::const_iterator it = + guest_web_contents_by_instance_id_.begin(); + it != guest_web_contents_by_instance_id_.end(); ++it) { + if (it->second->GetSiteInstance()->GetSiteURL() == guest_site) + return it->second->GetSiteInstance(); + } + return NULL; +} + +bool GuestViewManager::ForEachGuest(WebContents* embedder_web_contents, + const GuestCallback& callback) { + for (GuestInstanceMap::iterator it = + guest_web_contents_by_instance_id_.begin(); + it != guest_web_contents_by_instance_id_.end(); ++it) { + WebContents* guest = it->second; + if (embedder_web_contents != guest->GetEmbedderWebContents()) + continue; + + if (callback.Run(guest)) + return true; + } + return false; +} + +void GuestViewManager::AddRenderProcessHostID(int render_process_host_id) { + render_process_host_id_multiset_.insert(render_process_host_id); +} + +content::WebContents* GuestViewManager::GetGuestByInstanceID( + int guest_instance_id, + int embedder_render_process_id) { GuestInstanceMap::const_iterator it = guest_web_contents_by_instance_id_.find(guest_instance_id); if (it == guest_web_contents_by_instance_id_.end()) @@ -155,36 +205,6 @@ bool GuestViewManager::CanEmbedderAccessInstanceID( return CanEmbedderAccessGuest(embedder_render_process_id, guest_view); } -SiteInstance* GuestViewManager::GetGuestSiteInstance( - const GURL& guest_site) { - for (GuestInstanceMap::const_iterator it = - guest_web_contents_by_instance_id_.begin(); - it != guest_web_contents_by_instance_id_.end(); ++it) { - if (it->second->GetSiteInstance()->GetSiteURL() == guest_site) - return it->second->GetSiteInstance(); - } - return NULL; -} - -bool GuestViewManager::ForEachGuest(WebContents* embedder_web_contents, - const GuestCallback& callback) { - for (GuestInstanceMap::iterator it = - guest_web_contents_by_instance_id_.begin(); - it != guest_web_contents_by_instance_id_.end(); ++it) { - WebContents* guest = it->second; - if (embedder_web_contents != guest->GetEmbedderWebContents()) - continue; - - if (callback.Run(guest)) - return true; - } - return false; -} - -void GuestViewManager::AddRenderProcessHostID(int render_process_host_id) { - render_process_host_id_multiset_.insert(render_process_host_id); -} - bool GuestViewManager::CanEmbedderAccessGuest(int embedder_render_process_id, GuestViewBase* guest) { // The embedder can access the guest if it has not been attached and its diff --git a/chrome/browser/guest_view/guest_view_manager.h b/chrome/browser/guest_view/guest_view_manager.h index 0c73827..b26ae9c 100644 --- a/chrome/browser/guest_view/guest_view_manager.h +++ b/chrome/browser/guest_view/guest_view_manager.h @@ -29,19 +29,24 @@ class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, static GuestViewManager* FromBrowserContext(content::BrowserContext* context); + // Returns the guest WebContents associated with the given |guest_instance_id| + // if the provided |embedder_render_process_id| is allowed to access it. + // If the embedder is not allowed access, the embedder will be killed, and + // this method will return NULL. If no WebContents exists with the given + // instance ID, then NULL will also be returned. + content::WebContents* GetGuestByInstanceIDSafely( + int guest_instance_id, + int embedder_render_process_id); + // BrowserPluginGuestManagerDelegate implementation. virtual int GetNextInstanceID() OVERRIDE; virtual void AddGuest(int guest_instance_id, content::WebContents* guest_web_contents) OVERRIDE; virtual void RemoveGuest(int guest_instance_id) OVERRIDE; - virtual content::WebContents* GetGuestByInstanceID( + virtual void MaybeGetGuestByInstanceIDOrKill( int guest_instance_id, - int embedder_render_process_id) OVERRIDE; - virtual bool CanEmbedderAccessInstanceIDMaybeKill( int embedder_render_process_id, - int guest_instance_id) OVERRIDE; - virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, - int guest_instance_id) OVERRIDE; + const GuestByInstanceIDCallback& callback) OVERRIDE; virtual content::SiteInstance* GetGuestSiteInstance( const GURL& guest_site) OVERRIDE; virtual bool ForEachGuest(content::WebContents* embedder_web_contents, @@ -52,6 +57,17 @@ class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, void AddRenderProcessHostID(int render_process_host_id); + content::WebContents* GetGuestByInstanceID( + int guest_instance_id, + int embedder_render_process_id); + + bool CanEmbedderAccessInstanceIDMaybeKill( + int embedder_render_process_id, + int guest_instance_id); + + bool CanEmbedderAccessInstanceID(int embedder_render_process_id, + int guest_instance_id); + static bool CanEmbedderAccessGuest(int embedder_render_process_id, GuestViewBase* guest); diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc index 152f75e..3591dec 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc @@ -81,9 +81,11 @@ bool BrowserPluginEmbedder::DidSendScreenRectsCallback( } void BrowserPluginEmbedder::DidSendScreenRects() { - GetBrowserPluginGuestManager()->ForEachGuest(GetWebContents(), base::Bind( - &BrowserPluginEmbedder::DidSendScreenRectsCallback, - base::Unretained(this))); + BrowserPluginGuestManager::FromBrowserContext( + GetWebContents()->GetBrowserContext())->ForEachGuest( + GetWebContents(), base::Bind( + &BrowserPluginEmbedder::DidSendScreenRectsCallback, + base::Unretained(this))); } bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback( @@ -166,19 +168,12 @@ void BrowserPluginEmbedder::OnAllocateInstanceID(int request_id) { routing_id(), request_id, instance_id)); } -void BrowserPluginEmbedder::OnAttach( +void BrowserPluginEmbedder::OnGuestCallback( int instance_id, const BrowserPluginHostMsg_Attach_Params& params, - const base::DictionaryValue& extra_params) { + const base::DictionaryValue* extra_params, + BrowserPluginGuest* guest) { BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager(); - if (!guest_manager->CanEmbedderAccessInstanceIDMaybeKill( - GetWebContents()->GetRenderProcessHost()->GetID(), instance_id)) - return; - - BrowserPluginGuest* guest = - guest_manager->GetGuestByInstanceID( - instance_id, GetWebContents()->GetRenderProcessHost()->GetID()); - if (guest) { // There is an implicit order expectation here: // 1. The content embedder is made aware of the attachment. @@ -188,12 +183,12 @@ void BrowserPluginEmbedder::OnAttach( GetContentClient()->browser()->GuestWebContentsAttached( guest->GetWebContents(), GetWebContents(), - extra_params); - guest->Attach(GetWebContents(), params, extra_params); + *extra_params); + guest->Attach(GetWebContents(), params, *extra_params); return; } - scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy()); + scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy()); guest = guest_manager->CreateGuest( GetWebContents()->GetSiteInstance(), instance_id, params, @@ -202,9 +197,22 @@ void BrowserPluginEmbedder::OnAttach( GetContentClient()->browser()->GuestWebContentsAttached( guest->GetWebContents(), GetWebContents(), - extra_params); + *extra_params); guest->Initialize(params, GetWebContents()); } } +void BrowserPluginEmbedder::OnAttach( + int instance_id, + const BrowserPluginHostMsg_Attach_Params& params, + const base::DictionaryValue& extra_params) { + GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( + instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), + base::Bind(&BrowserPluginEmbedder::OnGuestCallback, + base::Unretained(this), + instance_id, + params, + &extra_params)); +} + } // namespace content diff --git a/content/browser/browser_plugin/browser_plugin_embedder.h b/content/browser/browser_plugin/browser_plugin_embedder.h index bce57a3..4df3dc4 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.h +++ b/content/browser/browser_plugin/browser_plugin_embedder.h @@ -97,6 +97,13 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, BrowserPluginGuest* guest); + // Called by the content embedder when a guest exists with the provided + // |instance_id|. + void OnGuestCallback(int instance_id, + const BrowserPluginHostMsg_Attach_Params& params, + const base::DictionaryValue* extra_params, + BrowserPluginGuest* guest); + // Message handlers. void OnAllocateInstanceID(int request_id); diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index eddc925..6f6d975 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -98,8 +98,20 @@ class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { const std::string& user_input) OVERRIDE { int embedder_render_process_id = guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); - BrowserPluginGuest* guest = guest_->GetBrowserPluginGuestManager()-> - GetGuestByInstanceID(instance_id_, embedder_render_process_id); + guest_->GetBrowserPluginGuestManager()-> + MaybeGetGuestByInstanceIDOrKill( + instance_id_, + embedder_render_process_id, + base::Bind(&BrowserPluginGuest::NewWindowRequest::RespondInternal, + base::Unretained(this), + should_allow)); + } + + private: + virtual ~NewWindowRequest() {} + + void RespondInternal(bool should_allow, + BrowserPluginGuest* guest) { if (!guest) { VLOG(0) << "Guest not found. Instance ID: " << instance_id_; return; @@ -110,8 +122,6 @@ class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { guest->Destroy(); } - private: - virtual ~NewWindowRequest() {} int instance_id_; }; diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc index 4bc4235..8e44c7f0 100644 --- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc +++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc @@ -121,18 +121,31 @@ BrowserPluginGuest* BrowserPluginGuestManager::CreateGuest( extra_params.Pass()); } -BrowserPluginGuest* BrowserPluginGuestManager::GetGuestByInstanceID( - int instance_id, - int embedder_render_process_id) const { - if (!GetDelegate()) - return NULL; +static void BrowserPluginGuestByInstanceIDCallback( + const BrowserPluginGuestManager::GuestByInstanceIDCallback& callback, + WebContents* guest_web_contents) { + if (!guest_web_contents) { + callback.Run(NULL); + return; + } + callback.Run(static_cast<WebContentsImpl*>(guest_web_contents)-> + GetBrowserPluginGuest()); +} - WebContentsImpl* guest_web_contents = static_cast<WebContentsImpl*>( - GetDelegate()->GetGuestByInstanceID(instance_id, - embedder_render_process_id)); +void BrowserPluginGuestManager::MaybeGetGuestByInstanceIDOrKill( + int instance_id, + int embedder_render_process_id, + const GuestByInstanceIDCallback& callback) const { + if (!GetDelegate()) { + callback.Run(NULL); + return; + } - return guest_web_contents ? - guest_web_contents->GetBrowserPluginGuest() : NULL; + GetDelegate()->MaybeGetGuestByInstanceIDOrKill( + instance_id, + embedder_render_process_id, + base::Bind(&BrowserPluginGuestByInstanceIDCallback, + callback)); } void BrowserPluginGuestManager::AddGuest(int instance_id, @@ -148,14 +161,11 @@ void BrowserPluginGuestManager::RemoveGuest(int instance_id) { GetDelegate()->RemoveGuest(instance_id); } -bool BrowserPluginGuestManager::CanEmbedderAccessInstanceIDMaybeKill( - int embedder_render_process_id, - int instance_id) const { - if (!GetDelegate()) - return false; - - return GetDelegate()->CanEmbedderAccessInstanceIDMaybeKill( - embedder_render_process_id, instance_id); +static void BrowserPluginGuestMessageCallback(const IPC::Message& message, + BrowserPluginGuest* guest) { + if (!guest) + return; + guest->OnMessageReceivedFromEmbedder(message); } void BrowserPluginGuestManager::OnMessageReceived(const IPC::Message& message, @@ -166,11 +176,10 @@ void BrowserPluginGuestManager::OnMessageReceived(const IPC::Message& message, PickleIterator iter(message); bool success = iter.ReadInt(&instance_id); DCHECK(success); - BrowserPluginGuest* guest = - GetGuestByInstanceID(instance_id, render_process_id); - if (!guest) - return; - guest->OnMessageReceivedFromEmbedder(message); + MaybeGetGuestByInstanceIDOrKill(instance_id, + render_process_id, + base::Bind(&BrowserPluginGuestMessageCallback, + message)); } SiteInstance* BrowserPluginGuestManager::GetGuestSiteInstance( diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.h b/content/browser/browser_plugin/browser_plugin_guest_manager.h index 3c157fe..31210dd 100644 --- a/content/browser/browser_plugin/browser_plugin_guest_manager.h +++ b/content/browser/browser_plugin/browser_plugin_guest_manager.h @@ -71,13 +71,6 @@ class CONTENT_EXPORT BrowserPluginGuestManager : const BrowserPluginHostMsg_Attach_Params& params, scoped_ptr<base::DictionaryValue> extra_params); - // Returns a BrowserPluginGuest given an |instance_id|. Returns NULL if the - // guest wasn't found. If the embedder is not permitted to access the given - // |instance_id|, the embedder is killed, and NULL is returned. - BrowserPluginGuest* GetGuestByInstanceID( - int instance_id, - int embedder_render_process_id) const; - // Adds a new |guest_web_contents| to the embedder (overridable in test). virtual void AddGuest(int instance_id, WebContents* guest_web_contents); @@ -85,10 +78,11 @@ class CONTENT_EXPORT BrowserPluginGuestManager : // BrowserPluginGuestManager. void RemoveGuest(int instance_id); - // Returns whether the specified embedder is permitted to access the given - // |instance_id|, and kills the embedder if not. - bool CanEmbedderAccessInstanceIDMaybeKill(int embedder_render_process_id, - int instance_id) const; + typedef base::Callback<void(BrowserPluginGuest*)> GuestByInstanceIDCallback; + void MaybeGetGuestByInstanceIDOrKill( + int instance_id, + int embedder_render_process_id, + const GuestByInstanceIDCallback& callback) const; typedef base::Callback<bool(BrowserPluginGuest*)> GuestCallback; bool ForEachGuest(WebContents* embedder_web_contents, @@ -111,6 +105,11 @@ class CONTENT_EXPORT BrowserPluginGuestManager : // The BrowserContext in which this manager this stored. BrowserContext* context_; + // Contains guests' WebContents, mapping from their instance ids. + typedef std::map<int, WebContents*> GuestInstanceMap; + GuestInstanceMap guest_web_contents_by_instance_id_; + int next_instance_id_; + DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuestManager); }; diff --git a/content/browser/browser_plugin/test_guest_manager_delegate.cc b/content/browser/browser_plugin/test_guest_manager_delegate.cc index 544e4dc..11d3b34 100644 --- a/content/browser/browser_plugin/test_guest_manager_delegate.cc +++ b/content/browser/browser_plugin/test_guest_manager_delegate.cc @@ -43,26 +43,17 @@ void TestGuestManagerDelegate::RemoveGuest( guest_web_contents_by_instance_id_.erase(it); } -WebContents* TestGuestManagerDelegate::GetGuestByInstanceID( - int guest_instance_id, - int embedder_render_process_id) { +void TestGuestManagerDelegate::MaybeGetGuestByInstanceIDOrKill( + int guest_instance_id, + int embedder_render_process_id, + const GuestByInstanceIDCallback& callback) { GuestInstanceMap::const_iterator it = guest_web_contents_by_instance_id_.find(guest_instance_id); - if (it == guest_web_contents_by_instance_id_.end()) - return NULL; - return it->second; -} - -bool TestGuestManagerDelegate::CanEmbedderAccessInstanceIDMaybeKill( - int embedder_render_process_id, - int guest_instance_id) { - return true; -} - -bool TestGuestManagerDelegate::CanEmbedderAccessInstanceID( - int embedder_render_process_id, - int guest_instance_id) { - return true; + if (it == guest_web_contents_by_instance_id_.end()) { + callback.Run(NULL); + return; + } + callback.Run(it->second); } SiteInstance* TestGuestManagerDelegate::GetGuestSiteInstance( diff --git a/content/browser/browser_plugin/test_guest_manager_delegate.h b/content/browser/browser_plugin/test_guest_manager_delegate.h index ebd1656..63f2811 100644 --- a/content/browser/browser_plugin/test_guest_manager_delegate.h +++ b/content/browser/browser_plugin/test_guest_manager_delegate.h @@ -25,14 +25,10 @@ class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { virtual void AddGuest(int guest_instance_id, WebContents* guest_web_contents) OVERRIDE; virtual void RemoveGuest(int guest_instance_id) OVERRIDE; - virtual WebContents* GetGuestByInstanceID( + virtual void MaybeGetGuestByInstanceIDOrKill( int guest_instance_id, - int embedder_render_process_id) OVERRIDE; - virtual bool CanEmbedderAccessInstanceIDMaybeKill( int embedder_render_process_id, - int guest_instance_id) OVERRIDE; - virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, - int guest_instance_id) OVERRIDE; + const GuestByInstanceIDCallback& callback) OVERRIDE; virtual SiteInstance* GetGuestSiteInstance( const GURL& guest_site) OVERRIDE; virtual bool ForEachGuest(WebContents* embedder_web_contents, diff --git a/content/public/browser/browser_plugin_guest_manager_delegate.cc b/content/public/browser/browser_plugin_guest_manager_delegate.cc index 369a23d..43012be 100644 --- a/content/public/browser/browser_plugin_guest_manager_delegate.cc +++ b/content/public/browser/browser_plugin_guest_manager_delegate.cc @@ -10,24 +10,6 @@ int BrowserPluginGuestManagerDelegate::GetNextInstanceID() { return 0; } -WebContents* BrowserPluginGuestManagerDelegate::GetGuestByInstanceID( - int guest_instance_id, - int embedder_render_process_id) { - return NULL; -} - -bool BrowserPluginGuestManagerDelegate::CanEmbedderAccessInstanceIDMaybeKill( - int embedder_render_process_id, - int guest_instance_id) { - return false; -} - -bool BrowserPluginGuestManagerDelegate::CanEmbedderAccessInstanceID( - int embedder_render_process_id, - int guest_instance_id) { - return false; -} - content::SiteInstance* BrowserPluginGuestManagerDelegate::GetGuestSiteInstance( const GURL& guest_site) { return NULL; diff --git a/content/public/browser/browser_plugin_guest_manager_delegate.h b/content/public/browser/browser_plugin_guest_manager_delegate.h index bc6ee68..484b09c 100644 --- a/content/public/browser/browser_plugin_guest_manager_delegate.h +++ b/content/public/browser/browser_plugin_guest_manager_delegate.h @@ -37,24 +37,17 @@ class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { // moves outside of content, this API will be unnecessary. virtual void RemoveGuest(int guest_instance_id) {} - // Returns a Webcontents given a |guest_instance_id|. Returns NULL if the - // guest wasn't found. If the embedder is not permitted to access the given - // |guest_instance_id|, the embedder is killed, and NULL is returned. - virtual WebContents* GetGuestByInstanceID(int guest_instance_id, - int embedder_render_process_id); - - // Returns whether the specified embedder is permitted to access the given - // |guest_instance_id|. - // TODO(fsamuel): Remove this. - virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, - int guest_instance_id); - - // Returns whether the specified embedder is permitted to access the given - // |guest_instance_id|, and kills the embedder if not. - // TODO(fsamuel): Remove this. - virtual bool CanEmbedderAccessInstanceIDMaybeKill( + typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; + // Requests a guest WebContents associated with the provided + // |guest_instance_id|. If a guest associated with the provided ID + // does not exist, then the |callback| will be called with a NULL + // WebContents. If the provided |embedder_render_process_id| does + // not own the requested guest, then the embedder will be killed, + // and the |callback| will not be called. + virtual void MaybeGetGuestByInstanceIDOrKill( + int guest_instance_id, int embedder_render_process_id, - int guest_instance_id); + const GuestByInstanceIDCallback& callback) {} // Returns an existing SiteInstance if the current profile has a guest of the // given |guest_site|. |