OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" |
6 | 6 |
7 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 7 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
10 #include "content/public/browser/render_view_host.h" | |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 BrowserPluginGuestHelper::BrowserPluginGuestHelper( | 14 BrowserPluginGuestHelper::BrowserPluginGuestHelper( |
15 BrowserPluginGuest* guest, | 15 BrowserPluginGuest* guest, |
16 RenderViewHost* render_view_host) | 16 RenderViewHost* render_view_host) |
17 : RenderViewHostObserver(render_view_host), | 17 : RenderViewHostObserver(render_view_host), |
18 guest_(guest) { | 18 guest_(guest) { |
19 } | 19 } |
20 | 20 |
21 BrowserPluginGuestHelper::~BrowserPluginGuestHelper() { | 21 BrowserPluginGuestHelper::~BrowserPluginGuestHelper() { |
22 } | 22 } |
23 | 23 |
24 bool BrowserPluginGuestHelper::OnMessageReceived( | 24 bool BrowserPluginGuestHelper::OnMessageReceived( |
25 const IPC::Message& message) { | 25 const IPC::Message& message) { |
26 bool handled = true; | 26 bool handled = true; |
27 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message) | 27 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message) |
| 28 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| 29 IPC_MESSAGE_UNHANDLED(handled = false) |
| 30 IPC_END_MESSAGE_MAP() |
| 31 |
| 32 if (static_cast<RenderViewHostImpl*>(render_view_host())->is_swapped_out()) { |
| 33 return handled; |
| 34 } |
| 35 |
| 36 handled = true; |
| 37 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message) |
28 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 38 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
29 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck) | 39 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck) |
30 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 40 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
31 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 41 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
32 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 42 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
33 OnMsgHasTouchEventHandlers) | 43 OnMsgHasTouchEventHandlers) |
34 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | 44 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
35 IPC_MESSAGE_UNHANDLED(handled = false) | 45 IPC_MESSAGE_UNHANDLED(handled = false) |
36 IPC_END_MESSAGE_MAP() | 46 IPC_END_MESSAGE_MAP() |
37 return handled; | 47 return handled; |
(...skipping 20 matching lines...) Expand all Loading... |
58 } | 68 } |
59 | 69 |
60 void BrowserPluginGuestHelper::OnMsgHasTouchEventHandlers(bool has_handlers) { | 70 void BrowserPluginGuestHelper::OnMsgHasTouchEventHandlers(bool has_handlers) { |
61 guest_->SetIsAcceptingTouchEvents(has_handlers); | 71 guest_->SetIsAcceptingTouchEvents(has_handlers); |
62 } | 72 } |
63 | 73 |
64 void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) { | 74 void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) { |
65 guest_->SetCursor(cursor); | 75 guest_->SetCursor(cursor); |
66 } | 76 } |
67 | 77 |
| 78 void BrowserPluginGuestHelper::OnRouteMessageEvent( |
| 79 const ViewMsg_PostMessage_Params& params) { |
| 80 guest_->RouteMessageEvent(params); |
| 81 } |
| 82 |
68 } // namespace content | 83 } // namespace content |
OLD | NEW |