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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_guest_role.cc

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Fixed tests. Also fixed a case where UpdateRect was being sent from bp renderer before NavigateGues… Created 8 years, 4 months 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 unified diff | Download patch
OLDNEW
(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_host_guest_role.h"
6
7 #include "base/time.h"
8 #include "content/browser/browser_plugin/browser_plugin_host_guest_delegate.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/public/browser/notification_details.h"
14 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/notification_source.h"
16 #include "content/public/browser/notification_types.h"
17 #include "content/common/view_messages.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 BrowserPluginHostGuestRole::BrowserPluginHostGuestRole(int instance_id,
26 WebContentsImpl* web_contents, RenderViewHost* render_view_host)
27 : RenderViewHostObserver(render_view_host) {
28 delegate_.reset(
29 new BrowserPluginHostGuestDelegate(instance_id, web_contents));
30 }
31
32 BrowserPluginHostGuestRole::~BrowserPluginHostGuestRole() {
33 }
34
35 BrowserPluginHostGuestDelegate* BrowserPluginHostGuestRole::GetDelegate() {
36 return delegate_.get();
37 }
38
39 bool BrowserPluginHostGuestRole::OnMessageReceived(
40 const IPC::Message& message) {
41 bool handled = true;
42 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostGuestRole, message)
43 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
44 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnHandleInputEventAck)
45 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
46 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
47 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
48 IPC_MESSAGE_UNHANDLED(handled = false)
49 IPC_END_MESSAGE_MAP()
50 return handled;
51 }
52
53 void BrowserPluginHostGuestRole::OnUpdateRect(
54 const ViewHostMsg_UpdateRect_Params& params) {
55 RenderWidgetHostImpl* render_widget_host =
56 RenderWidgetHostImpl::From(render_view_host());
57 render_widget_host->ResetFlags();
58 delegate_->UpdateRect(render_view_host(), params);
59 }
60
61 void BrowserPluginHostGuestRole::OnHandleInputEventAck(
62 WebKit::WebInputEvent::Type event_type,
63 bool processed) {
64 delegate_->HandleInputEventAck(render_view_host(), processed);
65 }
66
67 void BrowserPluginHostGuestRole::OnTakeFocus(bool reverse) {
68 delegate_->TakeFocus(reverse);
69 }
70
71 void BrowserPluginHostGuestRole::OnShowWidget(int route_id,
72 const gfx::Rect& initial_pos) {
73 delegate_->ShowWidget(render_view_host(), route_id, initial_pos);
74 }
75
76 void BrowserPluginHostGuestRole::OnSetCursor(const WebCursor& cursor) {
77 delegate_->SetCursor(cursor);
78 }
79
80 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698