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

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

Issue 11956022: Browser Plugin: Allocate Instance IDs in BrowserPluginEmbedder instead of BrowserPluginManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff against simplified focus Created 7 years, 11 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 031d4bf216807395f95297a9a3af1c8222f85523..256b38ba9774b33a96e1a2df0743d5fea176645a 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -31,7 +31,8 @@ BrowserPluginEmbedder::BrowserPluginEmbedder(
: WebContentsObserver(web_contents),
render_view_host_(render_view_host),
visible_(true),
- next_get_render_view_request_id_(0) {
+ next_get_render_view_request_id_(0),
+ instance_counter_(0) {
lazyboy 2013/01/17 17:39:25 prefer naming it such that it's clear that this is
Fady Samuel 2013/01/17 18:40:38 Done.
// Listen to visibility changes so that an embedder hides its guests
// as well.
registrar_.Add(this,
@@ -211,6 +212,8 @@ bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
}
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceIDRequest,
+ OnAllocateInstanceID)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest,
OnCreateGuest)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse,
@@ -294,10 +297,22 @@ bool BrowserPluginEmbedder::ShouldForwardToBrowserPluginGuest(
return false;
}
+void BrowserPluginEmbedder::OnAllocateInstanceID(int request_id) {
+ int instance_id = ++instance_counter_;
+ render_view_host_->Send(new BrowserPluginMsg_AllocateInstanceIDResponse(
+ render_view_host_->GetRoutingID(), request_id, instance_id));
+}
+
void BrowserPluginEmbedder::OnCreateGuest(
int instance_id,
const BrowserPluginHostMsg_CreateGuest_Params& params) {
CreateGuest(instance_id, MSG_ROUTING_NONE, NULL, params);
+ if (params.src.empty())
+ return;
+ BrowserPluginHostMsg_NavigateGuest navigate_msg(
+ render_view_host_->GetRoutingID(), instance_id, params.src);
+ GetGuestByInstanceID(instance_id)->
+ OnMessageReceivedFromEmbedder(navigate_msg);
}
void BrowserPluginEmbedder::OnPluginAtPositionResponse(

Powered by Google App Engine
This is Rietveld 408576698