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

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: Address comments from fady 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 1c0df05c942df80066710c2447d21e5c0403765c..c1733bad8dc860f6874b792cb404a186b6e34d48 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -25,6 +25,7 @@
#include "net/base/escape.h"
#include "ui/events/keycodes/keyboard_codes.h"
+
Fady Samuel 2014/06/03 16:36:34 Remove extra space.
lazyboy 2014/06/03 19:17:58 Done.
namespace content {
// static
@@ -106,8 +107,6 @@ void BrowserPluginEmbedder::SetZoomLevel(double level) {
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));
@@ -140,12 +139,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,
@@ -154,6 +147,19 @@ void BrowserPluginEmbedder::OnGuestCallback(
BrowserPluginGuest* guest = guest_web_contents ?
static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest() : NULL;
+ printf("OnGuestCallback: guest [%p]\n", guest);
+ 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.
@@ -165,25 +171,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());
}
}

Powered by Google App Engine
This is Rietveld 408576698