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_host_helper.h" | |
6 | |
7 #include "content/browser/browser_plugin/browser_plugin_host.h" | |
8 #include "content/common/browser_plugin_messages.h" | |
9 #include "content/public/browser/render_view_host.h" | |
10 #include "content/public/browser/render_widget_host_view.h" | |
11 #include "ipc/ipc_message_macros.h" | |
jam
2012/05/21 18:30:24
don't include this, it comes by default through th
Fady Samuel
2012/05/21 19:22:17
Done.
| |
12 #include "ui/gfx/size.h" | |
13 | |
14 namespace content { | |
15 | |
16 BrowserPluginHostHelper::BrowserPluginHostHelper( | |
17 BrowserPluginHost* browser_plugin_host, | |
18 RenderViewHost* render_view_host) | |
19 : RenderViewHostObserver(render_view_host), | |
20 browser_plugin_host_(browser_plugin_host) { | |
21 } | |
22 | |
23 BrowserPluginHostHelper::~BrowserPluginHostHelper() { | |
24 } | |
25 | |
26 | |
27 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { | |
28 bool handled = true; | |
29 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) | |
30 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel, | |
31 OnConnectToChannel) | |
32 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder, | |
33 OnNavigateGuestFromEmbedder) | |
34 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) | |
35 IPC_MESSAGE_UNHANDLED(handled = false) | |
36 IPC_END_MESSAGE_MAP() | |
37 return handled; | |
38 } | |
39 | |
40 void BrowserPluginHostHelper::OnConnectToChannel( | |
41 const IPC::ChannelHandle& channel_handle) { | |
42 browser_plugin_host_->ConnectEmbedderToChannel( | |
43 render_view_host(), | |
44 channel_handle); | |
45 } | |
46 | |
47 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( | |
48 int32 instance_id, | |
49 long long frame_id, | |
50 const std::string& src, | |
51 const gfx::Size& size) { | |
52 browser_plugin_host_->NavigateGuestFromEmbedder( | |
53 render_view_host(), | |
54 instance_id, | |
55 frame_id, | |
56 src, | |
57 size); | |
58 } | |
59 | |
60 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { | |
61 DCHECK(render_view_host()->GetView()); | |
jam
2012/05/21 18:30:24
nit: no need to null check this, if it's null the
Fady Samuel
2012/05/21 19:22:17
Done.
| |
62 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); | |
63 } | |
64 | |
65 } // namespace content | |
OLD | NEW |