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

Unified Diff: content/renderer/browser_plugin/browser_plugin_manager.cc

Issue 801173002: Fix message routing for BrowserPlugin in iframe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests that don't have a RenderThreadImpl Created 6 years 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/renderer/browser_plugin/browser_plugin_manager.cc
diff --git a/content/renderer/browser_plugin/browser_plugin_manager.cc b/content/renderer/browser_plugin/browser_plugin_manager.cc
index 2162144d58a1224053e82dc8c84c57133a34654f..7464d7002bfaf1feb00b6e9115794f1d4e6650f4 100644
--- a/content/renderer/browser_plugin/browser_plugin_manager.cc
+++ b/content/renderer/browser_plugin/browser_plugin_manager.cc
@@ -3,27 +3,26 @@
// found in the LICENSE file.
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
-
#include "base/memory/scoped_ptr.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/frame_messages.h"
#include "content/public/renderer/browser_plugin_delegate.h"
-#include "content/public/renderer/render_thread.h"
+#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/browser_plugin/browser_plugin.h"
+#include "content/renderer/render_thread_impl.h"
#include "ipc/ipc_message_macros.h"
namespace content {
// static
-BrowserPluginManager* BrowserPluginManager::Create(
- RenderViewImpl* render_view) {
- return new BrowserPluginManager(render_view);
+BrowserPluginManager* BrowserPluginManager::Get() {
+ if (!RenderThreadImpl::current())
+ return nullptr;
+ return RenderThreadImpl::current()->browser_plugin_manager();
}
-BrowserPluginManager::BrowserPluginManager(RenderViewImpl* render_view)
- : RenderViewObserver(render_view),
- render_view_(render_view->AsWeakPtr()) {
+BrowserPluginManager::BrowserPluginManager() {
}
BrowserPluginManager::~BrowserPluginManager() {
@@ -45,7 +44,7 @@ BrowserPlugin* BrowserPluginManager::GetBrowserPlugin(
}
int BrowserPluginManager::GetNextInstanceID() {
- return RenderThread::Get()->GenerateRoutingID();
+ return RenderThreadImpl::current()->GenerateRoutingID();
}
void BrowserPluginManager::UpdateDeviceScaleFactor() {
@@ -77,24 +76,30 @@ void BrowserPluginManager::Detach(int browser_plugin_instance_id) {
}
BrowserPlugin* BrowserPluginManager::CreateBrowserPlugin(
- RenderViewImpl* render_view,
- blink::WebFrame* frame,
+ RenderFrame* render_frame,
scoped_ptr<BrowserPluginDelegate> delegate) {
- return new BrowserPlugin(render_view, frame, delegate.Pass());
+ return new BrowserPlugin(render_frame, delegate.Pass());
}
-void BrowserPluginManager::DidCommitCompositorFrame() {
+void BrowserPluginManager::DidCommitCompositorFrame(
+ int render_view_routing_id) {
IDMap<BrowserPlugin>::iterator iter(&instances_);
while (!iter.IsAtEnd()) {
- iter.GetCurrentValue()->DidCommitCompositorFrame();
+ if (iter.GetCurrentValue()->render_view_routing_id() ==
+ render_view_routing_id) {
+ iter.GetCurrentValue()->DidCommitCompositorFrame();
+ }
iter.Advance();
}
}
-bool BrowserPluginManager::OnMessageReceived(
+bool BrowserPluginManager::OnControlMessageReceived(
const IPC::Message& message) {
- if (!BrowserPlugin::ShouldForwardToBrowserPlugin(message))
+ if (!BrowserPlugin::ShouldForwardToBrowserPlugin(message) &&
+ !content::GetContentClient()->renderer()->
+ ShouldForwardToGuestContainer(message)) {
return false;
+ }
int browser_plugin_instance_id = browser_plugin::kInstanceIDNone;
// All allowed messages must have |browser_plugin_instance_id| as their
@@ -117,7 +122,7 @@ bool BrowserPluginManager::OnMessageReceived(
}
bool BrowserPluginManager::Send(IPC::Message* msg) {
- return RenderThread::Get()->Send(msg);
+ return RenderThreadImpl::current()->Send(msg);
}
void BrowserPluginManager::OnCompositorFrameSwappedPluginUnavailable(
@@ -131,7 +136,7 @@ void BrowserPluginManager::OnCompositorFrameSwappedPluginUnavailable(
params.producing_route_id = param.b.producing_route_id;
params.output_surface_id = param.b.output_surface_id;
Send(new BrowserPluginHostMsg_CompositorFrameSwappedACK(
- routing_id(), param.a, params));
+ message.routing_id(), param.a, params));
}
} // namespace content
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_manager.h ('k') | content/renderer/child_frame_compositing_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698