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 "ui/gfx/size.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 BrowserPluginHostHelper::BrowserPluginHostHelper( |
| 16 BrowserPluginHost* browser_plugin_host, |
| 17 RenderViewHost* render_view_host) |
| 18 : RenderViewHostObserver(render_view_host), |
| 19 browser_plugin_host_(browser_plugin_host) { |
| 20 } |
| 21 |
| 22 BrowserPluginHostHelper::~BrowserPluginHostHelper() { |
| 23 } |
| 24 |
| 25 |
| 26 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { |
| 27 bool handled = true; |
| 28 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) |
| 29 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel, |
| 30 OnConnectToChannel) |
| 31 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder, |
| 32 OnNavigateGuestFromEmbedder) |
| 33 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) |
| 34 IPC_MESSAGE_UNHANDLED(handled = false) |
| 35 IPC_END_MESSAGE_MAP() |
| 36 return handled; |
| 37 } |
| 38 |
| 39 void BrowserPluginHostHelper::OnConnectToChannel( |
| 40 const IPC::ChannelHandle& channel_handle) { |
| 41 browser_plugin_host_->ConnectEmbedderToChannel( |
| 42 render_view_host(), |
| 43 channel_handle); |
| 44 } |
| 45 |
| 46 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( |
| 47 int32 instance_id, |
| 48 long long frame_id, |
| 49 const std::string& src, |
| 50 const gfx::Size& size) { |
| 51 browser_plugin_host_->NavigateGuestFromEmbedder( |
| 52 render_view_host(), |
| 53 instance_id, |
| 54 frame_id, |
| 55 src, |
| 56 size); |
| 57 } |
| 58 |
| 59 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { |
| 60 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); |
| 61 } |
| 62 |
| 63 } // namespace content |
OLD | NEW |