Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 511643002: BrowserPlugin: Simplify guest access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_embedder.cc
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index f02d315b4bd25caa5f5d09235599d7101ff93ed0..bbd690f9ff735d908e03b5e07beb8fbb19e32472 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(

Powered by Google App Engine
This is Rietveld 408576698