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

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

Issue 11606005: Browser Plugin: Simplify BrowserPluginGuestHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 8 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/browser/browser_plugin/browser_plugin_guest_helper.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest_helper.cc b/content/browser/browser_plugin/browser_plugin_guest_helper.cc
index 2c45aceda3433f9950345dc2b7c19385a443c847..85c6a1a3ed86cea304518bc5007ef63ca88f71d7 100644
--- a/content/browser/browser_plugin/browser_plugin_guest_helper.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest_helper.cc
@@ -5,7 +5,6 @@
#include "content/browser/browser_plugin/browser_plugin_guest_helper.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
-#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/drag_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_view_host.h"
@@ -24,66 +23,30 @@ BrowserPluginGuestHelper::~BrowserPluginGuestHelper() {
bool BrowserPluginGuestHelper::OnMessageReceived(
const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message)
- IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor)
- IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
- IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck)
- IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
- IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
- OnMsgHasTouchEventHandlers)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
- #if defined(OS_MACOSX)
- // MacOSX creates and populates platform-specific select drop-down menus
- // whereas other platforms merely create a popup window that the guest
- // renderer process paints inside.
- IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup)
- #endif
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void BrowserPluginGuestHelper::OnUpdateDragCursor(
- WebKit::WebDragOperation current_op) {
- guest_->UpdateDragCursor(current_op);
-}
-
-void BrowserPluginGuestHelper::OnUpdateRect(
- const ViewHostMsg_UpdateRect_Params& params) {
- guest_->UpdateRect(render_view_host(), params);
-}
-
-void BrowserPluginGuestHelper::OnHandleInputEventAck(
- WebKit::WebInputEvent::Type event_type,
- InputEventAckState ack_result) {
- guest_->HandleInputEventAck(render_view_host(),
- ack_result == INPUT_EVENT_ACK_STATE_CONSUMED);
-}
-
-void BrowserPluginGuestHelper::OnTakeFocus(bool reverse) {
- guest_->ViewTakeFocus(reverse);
+ if (ShouldForwardToBrowserPluginGuest(message))
+ return guest_->OnMessageReceived(message);
+ return false;
}
-void BrowserPluginGuestHelper::OnShowWidget(int route_id,
- const gfx::Rect& initial_pos) {
- guest_->ShowWidget(render_view_host(), route_id, initial_pos);
-}
-
-void BrowserPluginGuestHelper::OnMsgHasTouchEventHandlers(bool has_handlers) {
- guest_->SetIsAcceptingTouchEvents(has_handlers);
-}
-
-void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) {
- guest_->SetCursor(cursor);
-}
-
-#if defined(OS_MACOSX)
-void BrowserPluginGuestHelper::OnShowPopup(
- const ViewHostMsg_ShowPopup_Params& params) {
- guest_->ShowPopup(render_view_host(), params);
+// static
+bool BrowserPluginGuestHelper::ShouldForwardToBrowserPluginGuest(
+ const IPC::Message& message) {
+ switch (message.type()) {
+ case DragHostMsg_UpdateDragCursor::ID:
+ case ViewHostMsg_HandleInputEvent_ACK::ID:
+ case ViewHostMsg_HasTouchEventHandlers::ID:
+ case ViewHostMsg_SetCursor::ID:
+ #if defined(OS_MACOSX)
+ case ViewHostMsg_ShowPopup::ID:
+ #endif
+ case ViewHostMsg_ShowWidget::ID:
+ case ViewHostMsg_TakeFocus::ID:
+ case ViewHostMsg_UpdateRect::ID:
+ return true;
+ default:
+ break;
+ }
+ return false;
}
-#endif
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698