summaryrefslogtreecommitdiffstats
path: root/content/renderer/browser_plugin
diff options
context:
space:
mode:
authorfsamuel <fsamuel@chromium.org>2015-02-24 17:25:44 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-25 01:27:00 +0000
commit2e9413d8e27666cdd7961b5d17e7cb270bc48fc1 (patch)
tree32a85a2e106378f951d0efa42dcb6f2b528a3a72 /content/renderer/browser_plugin
parent08b8639e0a7c0db180bf6ff8e2a4c54b103df3ef (diff)
downloadchromium_src-2e9413d8e27666cdd7961b5d17e7cb270bc48fc1.zip
chromium_src-2e9413d8e27666cdd7961b5d17e7cb270bc48fc1.tar.gz
chromium_src-2e9413d8e27666cdd7961b5d17e7cb270bc48fc1.tar.bz2
Decouple BrowserPlugin from RenderView
With the move to out-of-process iframes, RenderFrames and away from RenderViews, this CL removes routing via RenderView Routing ID from BrowserPlugin. Aside from BrowserPluginHostMsg_Attach, which creates a new BrowserPluginEmbedder in the associated WebContents on first call, all other IPCs are now CONTROL because they do not rely on routing IDs. BUG=436339, 330264 TBR=kenrb@chromium.org for mechanical change to make all BrowserPluginHostMsg IPCs except ATTACH CONTROL instead of ROUTED. Review URL: https://codereview.chromium.org/929243003 Cr-Commit-Position: refs/heads/master@{#317940}
Diffstat (limited to 'content/renderer/browser_plugin')
-rw-r--r--content/renderer/browser_plugin/browser_plugin.cc41
-rw-r--r--content/renderer/browser_plugin/browser_plugin.h10
-rw-r--r--content/renderer/browser_plugin/browser_plugin_manager.cc8
-rw-r--r--content/renderer/browser_plugin/browser_plugin_manager.h2
4 files changed, 28 insertions, 33 deletions
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 93946fc..f64e25a 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -61,7 +61,7 @@ BrowserPlugin* BrowserPlugin::GetFromNode(blink::WebNode& node) {
BrowserPlugin::BrowserPlugin(RenderFrame* render_frame,
scoped_ptr<BrowserPluginDelegate> delegate)
: attached_(false),
- render_view_routing_id_(render_frame->GetRenderView()->GetRoutingID()),
+ render_frame_routing_id_(render_frame->GetRoutingID()),
container_(nullptr),
sad_guest_(nullptr),
guest_crashed_(false),
@@ -133,7 +133,7 @@ void BrowserPlugin::Attach() {
}
attach_params.view_size = gfx::Size(width(), height());
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Attach(
- render_view_routing_id_,
+ render_frame_routing_id_,
browser_plugin_instance_id_,
attach_params));
@@ -152,8 +152,8 @@ void BrowserPlugin::Detach() {
compositing_helper_ = nullptr;
}
- BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Detach(
- render_view_routing_id_, browser_plugin_instance_id_));
+ BrowserPluginManager::Get()->Send(
+ new BrowserPluginHostMsg_Detach(browser_plugin_instance_id_));
}
void BrowserPlugin::DidCommitCompositorFrame() {
@@ -163,7 +163,8 @@ void BrowserPlugin::DidCommitCompositorFrame() {
void BrowserPlugin::OnAdvanceFocus(int browser_plugin_instance_id,
bool reverse) {
- auto render_view = RenderViewImpl::FromRoutingID(render_view_routing_id());
+ auto render_frame = RenderFrameImpl::FromRoutingID(render_frame_routing_id());
+ auto render_view = render_frame ? render_frame->GetRenderView() : nullptr;
if (!render_view)
return;
render_view->GetWebView()->advanceFocus(reverse);
@@ -225,7 +226,9 @@ void BrowserPlugin::OnSetCursor(int browser_plugin_instance_id,
void BrowserPlugin::OnSetMouseLock(int browser_plugin_instance_id,
bool enable) {
- auto render_view = RenderViewImpl::FromRoutingID(render_view_routing_id());
+ auto render_frame = RenderFrameImpl::FromRoutingID(render_frame_routing_id());
+ auto render_view = static_cast<RenderViewImpl*>(
+ render_frame ? render_frame->GetRenderView() : nullptr);
if (enable) {
if (mouse_locked_ || !render_view)
return;
@@ -268,7 +271,6 @@ void BrowserPlugin::UpdateGuestFocusState(blink::WebFocusType focus_type) {
return;
bool should_be_focused = ShouldGuestBeFocused();
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus(
- render_view_routing_id_,
browser_plugin_instance_id_,
should_be_focused,
focus_type));
@@ -276,7 +278,9 @@ void BrowserPlugin::UpdateGuestFocusState(blink::WebFocusType focus_type) {
bool BrowserPlugin::ShouldGuestBeFocused() const {
bool embedder_focused = false;
- auto render_view = RenderViewImpl::FromRoutingID(render_view_routing_id());
+ auto render_frame = RenderFrameImpl::FromRoutingID(render_frame_routing_id());
+ auto render_view = static_cast<RenderViewImpl*>(
+ render_frame ? render_frame->GetRenderView() : nullptr);
if (render_view)
embedder_focused = render_view->has_focus();
return plugin_focused_ && embedder_focused;
@@ -340,7 +344,9 @@ void BrowserPlugin::destroy() {
container_ = nullptr;
// Will be a no-op if the mouse is not currently locked.
- auto render_view = RenderViewImpl::FromRoutingID(render_view_routing_id());
+ auto render_frame = RenderFrameImpl::FromRoutingID(render_frame_routing_id());
+ auto render_view = static_cast<RenderViewImpl*>(
+ render_frame ? render_frame->GetRenderView() : nullptr);
if (render_view)
render_view->mouse_lock_dispatcher()->OnLockTargetDestroyed(this);
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
@@ -434,7 +440,7 @@ void BrowserPlugin::updateGeometry(
if (old_width == window_rect.width && old_height == window_rect.height) {
// Let the browser know about the updated view rect.
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateGeometry(
- render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_));
+ browser_plugin_instance_id_, plugin_rect_));
return;
}
@@ -461,7 +467,6 @@ void BrowserPlugin::updateVisibility(bool visible) {
compositing_helper_->UpdateVisibility(visible);
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility(
- render_view_routing_id_,
browser_plugin_instance_id_,
visible));
}
@@ -482,15 +487,13 @@ bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event,
!edit_commands_.empty()) {
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
- render_view_routing_id_,
browser_plugin_instance_id_,
edit_commands_));
edit_commands_.clear();
}
BrowserPluginManager::Get()->Send(
- new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
- browser_plugin_instance_id_,
+ new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
plugin_rect_,
&event));
GetWebKitCursorInfo(cursor_, &cursor_info);
@@ -506,7 +509,6 @@ bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
return false;
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_DragStatusUpdate(
- render_view_routing_id_,
browser_plugin_instance_id_,
drag_status,
DropDataBuilder::Build(drag_data),
@@ -544,7 +546,6 @@ void BrowserPlugin::didFailLoadingFrameRequest(
bool BrowserPlugin::executeEditCommand(const blink::WebString& name) {
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
- render_view_routing_id_,
browser_plugin_instance_id_,
name.utf8()));
@@ -571,7 +572,6 @@ bool BrowserPlugin::setComposition(
std_underlines.push_back(underlines[i]);
}
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ImeSetComposition(
- render_view_routing_id_,
browser_plugin_instance_id_,
text.utf8(),
std_underlines,
@@ -589,7 +589,6 @@ bool BrowserPlugin::confirmComposition(
bool keep_selection = (selectionBehavior == blink::WebWidget::KeepSelection);
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_ImeConfirmComposition(
- render_view_routing_id_,
browser_plugin_instance_id_,
text.utf8(),
keep_selection));
@@ -602,7 +601,6 @@ void BrowserPlugin::extendSelectionAndDelete(int before, int after) {
return;
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_ExtendSelectionAndDelete(
- render_view_routing_id_,
browser_plugin_instance_id_,
before,
after));
@@ -611,7 +609,6 @@ void BrowserPlugin::extendSelectionAndDelete(int before, int after) {
void BrowserPlugin::OnLockMouseACK(bool succeeded) {
mouse_locked_ = succeeded;
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
- render_view_routing_id_,
browser_plugin_instance_id_,
succeeded));
}
@@ -619,15 +616,13 @@ void BrowserPlugin::OnLockMouseACK(bool succeeded) {
void BrowserPlugin::OnMouseLockLost() {
mouse_locked_ = false;
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
- render_view_routing_id_,
browser_plugin_instance_id_));
}
bool BrowserPlugin::HandleMouseLockedInputEvent(
const blink::WebMouseEvent& event) {
BrowserPluginManager::Get()->Send(
- new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
- browser_plugin_instance_id_,
+ new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_,
plugin_rect_,
&event));
return true;
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index b5287f4..47c405a 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -32,7 +32,7 @@ class CONTENT_EXPORT BrowserPlugin :
public:
static BrowserPlugin* GetFromNode(blink::WebNode& node);
- int render_view_routing_id() const { return render_view_routing_id_; }
+ int render_frame_routing_id() const { return render_frame_routing_id_; }
int browser_plugin_instance_id() const { return browser_plugin_instance_id_; }
bool attached() const { return attached_; }
@@ -168,10 +168,10 @@ class CONTENT_EXPORT BrowserPlugin :
// This indicates whether this BrowserPlugin has been attached to a
// WebContents and is ready to receive IPCs.
bool attached_;
- // We cache the |render_view_|'s routing ID because we need it on destruction.
- // If the |render_view_| is destroyed before the BrowserPlugin is destroyed
- // then we will attempt to access a NULL pointer.
- const int render_view_routing_id_;
+ // We cache the |render_frame_routing_id| because we need it on destruction.
+ // If the RenderFrame is destroyed before the BrowserPlugin is destroyed
+ // then we will attempt to access a nullptr.
+ const int render_frame_routing_id_;
blink::WebPluginContainer* container_;
gfx::Rect plugin_rect_;
// Bitmap for crashed plugin. Lazily initialized, non-owning pointer.
diff --git a/content/renderer/browser_plugin/browser_plugin_manager.cc b/content/renderer/browser_plugin/browser_plugin_manager.cc
index c0ae82d..a486186 100644
--- a/content/renderer/browser_plugin/browser_plugin_manager.cc
+++ b/content/renderer/browser_plugin/browser_plugin_manager.cc
@@ -74,11 +74,11 @@ BrowserPlugin* BrowserPluginManager::CreateBrowserPlugin(
}
void BrowserPluginManager::DidCommitCompositorFrame(
- int render_view_routing_id) {
+ int render_frame_routing_id) {
IDMap<BrowserPlugin>::iterator iter(&instances_);
while (!iter.IsAtEnd()) {
- if (iter.GetCurrentValue()->render_view_routing_id() ==
- render_view_routing_id) {
+ if (iter.GetCurrentValue()->render_frame_routing_id() ==
+ render_frame_routing_id) {
iter.GetCurrentValue()->DidCommitCompositorFrame();
}
iter.Advance();
@@ -128,7 +128,7 @@ void BrowserPluginManager::OnCompositorFrameSwappedPluginUnavailable(
params.producing_route_id = get<1>(param).producing_route_id;
params.output_surface_id = get<1>(param).output_surface_id;
Send(new BrowserPluginHostMsg_CompositorFrameSwappedACK(
- message.routing_id(), get<0>(param), params));
+ get<0>(param), params));
}
} // namespace content
diff --git a/content/renderer/browser_plugin/browser_plugin_manager.h b/content/renderer/browser_plugin/browser_plugin_manager.h
index bc79b2f..b7a888b 100644
--- a/content/renderer/browser_plugin/browser_plugin_manager.h
+++ b/content/renderer/browser_plugin/browser_plugin_manager.h
@@ -53,7 +53,7 @@ class CONTENT_EXPORT BrowserPluginManager : public RenderProcessObserver {
// unique per process.
int GetNextInstanceID();
- void DidCommitCompositorFrame(int render_view_routing_id);
+ void DidCommitCompositorFrame(int render_frame_routing_id);
bool Send(IPC::Message* msg);
// RenderProcessObserver override.