| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" | |
| 6 | |
| 7 #include "content/browser/browser_plugin/browser_plugin_guest.h" | |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | |
| 9 #include "content/common/view_messages.h" | |
| 10 #include "content/public/browser/render_view_host.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 BrowserPluginGuestHelper::BrowserPluginGuestHelper( | |
| 15 BrowserPluginGuest* guest, | |
| 16 RenderViewHost* render_view_host) | |
| 17 : RenderViewHostObserver(render_view_host), | |
| 18 guest_(guest) { | |
| 19 } | |
| 20 | |
| 21 BrowserPluginGuestHelper::~BrowserPluginGuestHelper() { | |
| 22 } | |
| 23 | |
| 24 bool BrowserPluginGuestHelper::OnMessageReceived( | |
| 25 const IPC::Message& message) { | |
| 26 bool handled = true; | |
| 27 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message) | |
| 28 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | |
| 29 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck) | |
| 30 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | |
| 31 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | |
| 32 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | |
| 33 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 34 IPC_END_MESSAGE_MAP() | |
| 35 return handled; | |
| 36 } | |
| 37 | |
| 38 void BrowserPluginGuestHelper::OnUpdateRect( | |
| 39 const ViewHostMsg_UpdateRect_Params& params) { | |
| 40 guest_->UpdateRect(render_view_host(), params); | |
| 41 } | |
| 42 | |
| 43 void BrowserPluginGuestHelper::OnHandleInputEventAck( | |
| 44 WebKit::WebInputEvent::Type event_type, | |
| 45 bool processed) { | |
| 46 guest_->HandleInputEventAck(render_view_host(), processed); | |
| 47 } | |
| 48 | |
| 49 void BrowserPluginGuestHelper::OnTakeFocus(bool reverse) { | |
| 50 guest_->ViewTakeFocus(reverse); | |
| 51 } | |
| 52 | |
| 53 void BrowserPluginGuestHelper::OnShowWidget(int route_id, | |
| 54 const gfx::Rect& initial_pos) { | |
| 55 guest_->ShowWidget(render_view_host(), route_id, initial_pos); | |
| 56 } | |
| 57 | |
| 58 void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) { | |
| 59 guest_->SetCursor(cursor); | |
| 60 } | |
| 61 | |
| 62 } // namespace content | |
| OLD | NEW |