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

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: Merged with ToT 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..779ee94006d37b0eb9d41e6195fba84dae8d2226 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),
+ next_instance_id_(0) {
// Listen to visibility changes so that an embedder hides its guests
// as well.
registrar_.Add(this,
@@ -155,6 +156,14 @@ void BrowserPluginEmbedder::CreateGuest(
render_view_host_->GetRoutingID(), instance_id, guest_routing_id));
guest->Initialize(params, guest_web_contents->GetRenderViewHost());
+
+ if (params.src.empty())
+ return;
+
+ BrowserPluginHostMsg_NavigateGuest navigate_msg(
+ render_view_host_->GetRoutingID(), instance_id, params.src);
+ GetGuestByInstanceID(instance_id)->
+ OnMessageReceivedFromEmbedder(navigate_msg);
}
BrowserPluginGuest* BrowserPluginEmbedder::GetGuestByInstanceID(
@@ -211,6 +220,8 @@ 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_CreateGuest,
OnCreateGuest)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse,
@@ -294,6 +305,12 @@ bool BrowserPluginEmbedder::ShouldForwardToBrowserPluginGuest(
return false;
}
+void BrowserPluginEmbedder::OnAllocateInstanceID(int request_id) {
+ int instance_id = ++next_instance_id_;
+ render_view_host_->Send(new BrowserPluginMsg_AllocateInstanceID_ACK(
+ render_view_host_->GetRoutingID(), request_id, instance_id));
+}
+
void BrowserPluginEmbedder::OnCreateGuest(
int instance_id,
const BrowserPluginHostMsg_CreateGuest_Params& params) {

Powered by Google App Engine
This is Rietveld 408576698