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/old/browser_plugin_host_helper.h" | |
6 | |
7 #include "content/browser/browser_plugin/old/browser_plugin_host.h" | |
8 #include "content/common/old_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 "ui/gfx/size.h" | |
12 | |
13 namespace content { | |
14 namespace old { | |
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(OldBrowserPluginHostMsg_ConnectToChannel, | |
31 OnConnectToChannel) | |
32 IPC_MESSAGE_HANDLER(OldBrowserPluginHostMsg_NavigateFromEmbedder, | |
33 OnNavigateGuestFromEmbedder) | |
34 IPC_MESSAGE_HANDLER(OldBrowserPluginHostMsg_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 browser_plugin_host_->NavigateGuestFromEmbedder( | |
52 render_view_host(), | |
53 instance_id, | |
54 frame_id, | |
55 src); | |
56 } | |
57 | |
58 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { | |
59 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); | |
60 } | |
61 | |
62 } // namespace old | |
63 } // namespace content | |
OLD | NEW |