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

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

Issue 801173002: Fix message routing for BrowserPlugin in iframe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup 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.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index ed2b4266fcc51f4c834e290bb12cc68a32849c91..cb72998dc0a5ac4970ccacd8592dfbf8afb8eba5 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -72,12 +72,12 @@ BrowserPlugin::BrowserPlugin(RenderViewImpl* render_view,
visible_(true),
mouse_locked_(false),
ready_(false),
- browser_plugin_manager_(render_view->GetBrowserPluginManager()),
browser_plugin_instance_id_(browser_plugin::kInstanceIDNone),
contents_opaque_(true),
delegate_(delegate.Pass()),
weak_ptr_factory_(this) {
- browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID();
+ browser_plugin_instance_id_ =
+ BrowserPluginManager::Get()->GetNextInstanceID();
if (delegate_)
delegate_->SetElementInstanceID(browser_plugin_instance_id_);
@@ -87,7 +87,7 @@ BrowserPlugin::~BrowserPlugin() {
if (compositing_helper_.get())
compositing_helper_->OnContainerDestroy();
- browser_plugin_manager()->RemoveBrowserPlugin(browser_plugin_instance_id_);
+ BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_);
}
bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
@@ -103,7 +103,8 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents,
OnShouldAcceptTouchEvents)
- IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_MESSAGE_UNHANDLED(
+ handled = delegate_ && delegate_->OnMessageReceived(message))
IPC_END_MESSAGE_MAP()
return handled;
}
@@ -138,7 +139,7 @@ void BrowserPlugin::Attach() {
PopulateResizeGuestParameters(view_size,
&attach_params.resize_guest_params);
}
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_Attach(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Attach(
render_view_routing_id_,
browser_plugin_instance_id_,
attach_params));
@@ -158,7 +159,7 @@ void BrowserPlugin::Detach() {
compositing_helper_ = NULL;
}
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_Detach(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Detach(
render_view_routing_id_, browser_plugin_instance_id_));
}
@@ -275,7 +276,7 @@ void BrowserPlugin::UpdateDeviceScaleFactor() {
BrowserPluginHostMsg_ResizeGuest_Params params;
PopulateResizeGuestParameters(plugin_size(), &params);
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest(
render_view_routing_id_,
browser_plugin_instance_id_,
params));
@@ -285,7 +286,7 @@ void BrowserPlugin::UpdateGuestFocusState() {
if (!attached())
return;
bool should_be_focused = ShouldGuestBeFocused();
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus(
render_view_routing_id_,
browser_plugin_instance_id_,
should_be_focused));
@@ -311,7 +312,8 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) {
g_plugin_container_map.Get().insert(std::make_pair(container_, this));
- browser_plugin_manager()->AddBrowserPlugin(browser_plugin_instance_id_, this);
+ BrowserPluginManager::Get()->AddBrowserPlugin(
+ browser_plugin_instance_id_, this);
// This is a way to notify observers of our attributes that this plugin is
// available in render tree.
@@ -441,14 +443,14 @@ void BrowserPlugin::updateGeometry(
if (old_width == window_rect.width && old_height == window_rect.height) {
// Let the browser know about the updated view rect.
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateGeometry(
render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_));
return;
}
BrowserPluginHostMsg_ResizeGuest_Params params;
PopulateResizeGuestParameters(plugin_size(), &params);
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest(
render_view_routing_id_,
browser_plugin_instance_id_,
params));
@@ -481,7 +483,7 @@ void BrowserPlugin::updateVisibility(bool visible) {
if (compositing_helper_.get())
compositing_helper_->UpdateVisibility(visible);
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility(
render_view_routing_id_,
browser_plugin_instance_id_,
visible));
@@ -501,7 +503,7 @@ bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event,
if (blink::WebInputEvent::isKeyboardEventType(event.type) &&
!edit_commands_.empty()) {
- browser_plugin_manager()->Send(
+ BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
render_view_routing_id_,
browser_plugin_instance_id_,
@@ -509,7 +511,7 @@ bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event,
edit_commands_.clear();
}
- browser_plugin_manager()->Send(
+ BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
browser_plugin_instance_id_,
plugin_rect_,
@@ -525,7 +527,7 @@ bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
const blink::WebPoint& screen) {
if (guest_crashed_ || !attached())
return false;
- browser_plugin_manager()->Send(
+ BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_DragStatusUpdate(
render_view_routing_id_,
browser_plugin_instance_id_,
@@ -564,7 +566,7 @@ void BrowserPlugin::didFailLoadingFrameRequest(
}
bool BrowserPlugin::executeEditCommand(const blink::WebString& name) {
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
render_view_routing_id_,
browser_plugin_instance_id_,
name.utf8()));
@@ -591,7 +593,7 @@ bool BrowserPlugin::setComposition(
for (size_t i = 0; i < underlines.size(); ++i) {
std_underlines.push_back(underlines[i]);
}
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_ImeSetComposition(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ImeSetComposition(
render_view_routing_id_,
browser_plugin_instance_id_,
text.utf8(),
@@ -608,11 +610,12 @@ bool BrowserPlugin::confirmComposition(
if (!attached())
return false;
bool keep_selection = (selectionBehavior == blink::WebWidget::KeepSelection);
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_ImeConfirmComposition(
- render_view_routing_id_,
- browser_plugin_instance_id_,
- text.utf8(),
- keep_selection));
+ BrowserPluginManager::Get()->Send(
+ new BrowserPluginHostMsg_ImeConfirmComposition(
+ render_view_routing_id_,
+ browser_plugin_instance_id_,
+ text.utf8(),
+ keep_selection));
// TODO(kochi): This assumes the IPC handling always succeeds.
return true;
}
@@ -620,7 +623,7 @@ bool BrowserPlugin::confirmComposition(
void BrowserPlugin::extendSelectionAndDelete(int before, int after) {
if (!attached())
return;
- browser_plugin_manager()->Send(
+ BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_ExtendSelectionAndDelete(
render_view_routing_id_,
browser_plugin_instance_id_,
@@ -630,7 +633,7 @@ void BrowserPlugin::extendSelectionAndDelete(int before, int after) {
void BrowserPlugin::OnLockMouseACK(bool succeeded) {
mouse_locked_ = succeeded;
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
render_view_routing_id_,
browser_plugin_instance_id_,
succeeded));
@@ -638,14 +641,14 @@ void BrowserPlugin::OnLockMouseACK(bool succeeded) {
void BrowserPlugin::OnMouseLockLost() {
mouse_locked_ = false;
- browser_plugin_manager()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
+ BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
render_view_routing_id_,
browser_plugin_instance_id_));
}
bool BrowserPlugin::HandleMouseLockedInputEvent(
const blink::WebMouseEvent& event) {
- browser_plugin_manager()->Send(
+ BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
browser_plugin_instance_id_,
plugin_rect_,

Powered by Google App Engine
This is Rietveld 408576698