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 "base/time.h" | |
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" | |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | |
10 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
11 #include "content/browser/web_contents/web_contents_impl.h" | |
12 #include "content/common/browser_plugin_messages.h" | |
13 #include "content/common/view_messages.h" | |
14 #include "content/public/browser/notification_details.h" | |
15 #include "content/public/browser/notification_service.h" | |
16 #include "content/public/browser/notification_source.h" | |
17 #include "content/public/browser/notification_types.h" | |
18 #include "content/public/browser/render_process_host.h" | |
19 #include "content/public/browser/render_view_host.h" | |
20 #include "content/public/browser/render_widget_host_view.h" | |
21 #include "ui/gfx/size.h" | |
22 | |
23 namespace content { | |
24 | |
25 BrowserPluginGuestHelper::BrowserPluginGuestHelper( | |
26 BrowserPluginGuest* guest, | |
27 RenderViewHost* render_view_host) | |
28 : RenderViewHostObserver(render_view_host), | |
29 guest_(guest) { | |
30 } | |
31 | |
32 BrowserPluginGuestHelper::~BrowserPluginGuestHelper() { | |
33 } | |
34 | |
35 bool BrowserPluginGuestHelper::OnMessageReceived( | |
36 const IPC::Message& message) { | |
37 bool handled = true; | |
38 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestHelper, message) | |
39 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | |
40 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck) | |
41 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | |
42 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | |
43 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | |
44 IPC_MESSAGE_UNHANDLED(handled = false) | |
45 IPC_END_MESSAGE_MAP() | |
46 return handled; | |
47 } | |
48 | |
49 void BrowserPluginGuestHelper::OnUpdateRect( | |
50 const ViewHostMsg_UpdateRect_Params& params) { | |
51 RenderWidgetHostImpl* render_widget_host = | |
52 RenderWidgetHostImpl::From(render_view_host()); | |
53 render_widget_host->ResetSizeAndRepaintPendingFlags(); | |
awong
2012/09/09 18:08:09
If this whole object is really meant to be a passt
lazyboy
2012/09/10 16:30:17
Done.
| |
54 guest_->UpdateRect(render_view_host(), params); | |
55 } | |
56 | |
57 void BrowserPluginGuestHelper::OnHandleInputEventAck( | |
58 WebKit::WebInputEvent::Type event_type, | |
59 bool processed) { | |
60 guest_->HandleInputEventAck(render_view_host(), processed); | |
61 } | |
62 | |
63 void BrowserPluginGuestHelper::OnTakeFocus(bool reverse) { | |
64 guest_->ViewTakeFocus(reverse); | |
65 } | |
66 | |
67 void BrowserPluginGuestHelper::OnShowWidget(int route_id, | |
68 const gfx::Rect& initial_pos) { | |
69 guest_->ShowWidget(render_view_host(), route_id, initial_pos); | |
70 } | |
71 | |
72 void BrowserPluginGuestHelper::OnSetCursor(const WebCursor& cursor) { | |
73 guest_->SetCursor(cursor); | |
74 } | |
75 | |
76 } // namespace content | |
OLD | NEW |