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

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

Issue 264943006: BrowserPlugin: Simplify content/public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_v1
Patch Set: Fixed nit Created 6 years, 7 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 152f75ee0736b03bd726fa9c9b355e24b61f5263..3591decaaf9592fc0b056c6ef8fed07102b15ec2 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

Powered by Google App Engine
This is Rietveld 408576698