diff options
author | fsamuel <fsamuel@chromium.org> | 2014-08-26 18:11:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-27 01:14:23 +0000 |
commit | 986f59179731e7970d99d9e8d1a7de43719c73bc (patch) | |
tree | 3d1a08da24ce475b06eb180cf816e4fd05e97494 /content/browser/browser_plugin/browser_plugin_embedder.cc | |
parent | 8f65982274893958898690b22e1c0c9ed4968857 (diff) | |
download | chromium_src-986f59179731e7970d99d9e8d1a7de43719c73bc.zip chromium_src-986f59179731e7970d99d9e8d1a7de43719c73bc.tar.gz chromium_src-986f59179731e7970d99d9e8d1a7de43719c73bc.tar.bz2 |
BrowserPlugin: Simplify guest access
Now that it's impossible for content to create guests and it's impossible
for a compromised embedder to access a guest it does not have permission to
access from content, BrowserPluginGuestManager::MaybeGetGuestByInstanceIDOrKill
seems a bit heavy-handed. This CL simplifies the API a bit.
This is also a prerequiste to support accessibility in BrowserPlugin.
BUG=226145
Review URL: https://codereview.chromium.org/511643002
Cr-Commit-Position: refs/heads/master@{#292060}
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_embedder.cc | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc index f02d315..bbd690f 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc @@ -132,27 +132,17 @@ void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { *handled = (guest_dragging_over_.get() != NULL); } -void BrowserPluginEmbedder::OnGuestCallback( - int browser_plugin_instance_id, - const BrowserPluginHostMsg_Attach_Params& params, - WebContents* guest_web_contents) { - BrowserPluginGuest* guest = guest_web_contents ? - static_cast<WebContentsImpl*>(guest_web_contents)-> - GetBrowserPluginGuest() : NULL; - if (guest) - guest->Attach(browser_plugin_instance_id, GetWebContents(), params); -} - void BrowserPluginEmbedder::OnAttach( int browser_plugin_instance_id, const BrowserPluginHostMsg_Attach_Params& params) { - GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( - web_contents(), - browser_plugin_instance_id, - base::Bind(&BrowserPluginEmbedder::OnGuestCallback, - base::Unretained(this), - browser_plugin_instance_id, - params)); + WebContents* guest_web_contents = + GetBrowserPluginGuestManager()->GetGuestByInstanceID( + GetWebContents(), browser_plugin_instance_id); + if (!guest_web_contents) + return; + BrowserPluginGuest* guest = static_cast<WebContentsImpl*>(guest_web_contents) + ->GetBrowserPluginGuest(); + guest->Attach(browser_plugin_instance_id, GetWebContents(), params); } bool BrowserPluginEmbedder::HandleKeyboardEvent( |