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

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

Issue 299753011: Move allocate instance id to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HasPermission function moved Created 6 years, 6 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 b14359ccf9b33f66d2adc6ea7a2e39c27da2673e..42f8f95fecf66711db69f519644aefb820de5801 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -83,8 +83,6 @@ void BrowserPluginEmbedder::DidSendScreenRects() {
bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message)
- IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID,
- OnAllocateInstanceID)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach)
IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor,
OnUpdateDragCursor(&handled));
@@ -117,12 +115,6 @@ void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) {
*handled = (guest_dragging_over_.get() != NULL);
}
-void BrowserPluginEmbedder::OnAllocateInstanceID(int request_id) {
- int instance_id = GetBrowserPluginGuestManager()->GetNextInstanceID();
- Send(new BrowserPluginMsg_AllocateInstanceID_ACK(
- routing_id(), request_id, instance_id));
-}
-
void BrowserPluginEmbedder::OnGuestCallback(
int instance_id,
const BrowserPluginHostMsg_Attach_Params& params,
@@ -131,6 +123,19 @@ void BrowserPluginEmbedder::OnGuestCallback(
BrowserPluginGuest* guest = guest_web_contents ?
static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest() : NULL;
+ if (!guest) {
+ scoped_ptr<base::DictionaryValue> copy_extra_params(
+ extra_params->DeepCopy());
+ guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest(
+ GetWebContents()->GetSiteInstance(),
+ instance_id,
+ copy_extra_params.Pass());
+ guest = guest_web_contents
+ ? static_cast<WebContentsImpl*>(guest_web_contents)
+ ->GetBrowserPluginGuest()
+ : NULL;
+ }
+
if (guest) {
// There is an implicit order expectation here:
// 1. The content embedder is made aware of the attachment.
@@ -142,25 +147,6 @@ void BrowserPluginEmbedder::OnGuestCallback(
GetWebContents(),
*extra_params);
guest->Attach(GetWebContents(), params, *extra_params);
- return;
- }
-
- scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy());
- guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest(
- GetWebContents()->GetSiteInstance(),
- instance_id,
- params.storage_partition_id,
- params.persist_storage,
- copy_extra_params.Pass());
- guest = guest_web_contents ?
- static_cast<WebContentsImpl*>(guest_web_contents)->
- GetBrowserPluginGuest() : NULL;
- if (guest) {
- GetContentClient()->browser()->GuestWebContentsAttached(
- guest->GetWebContents(),
- GetWebContents(),
- *extra_params);
- guest->Initialize(params, GetWebContents());
}
}
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.h ('k') | content/browser/browser_plugin/browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698