| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/browser_plugin/old/browser_plugin_host_helper.h" | 5 #include "content/browser/browser_plugin/old/browser_plugin_host_helper.h" |
| 6 | 6 |
| 7 #include "content/browser/browser_plugin/old/browser_plugin_host.h" | 7 #include "content/browser/browser_plugin/old/browser_plugin_host.h" |
| 8 #include "content/common/browser_plugin_messages.h" | 8 #include "content/common/old_browser_plugin_messages.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 BrowserPluginHostHelper::BrowserPluginHostHelper( | 15 BrowserPluginHostHelper::BrowserPluginHostHelper( |
| 16 BrowserPluginHost* browser_plugin_host, | 16 BrowserPluginHost* browser_plugin_host, |
| 17 RenderViewHost* render_view_host) | 17 RenderViewHost* render_view_host) |
| 18 : RenderViewHostObserver(render_view_host), | 18 : RenderViewHostObserver(render_view_host), |
| 19 browser_plugin_host_(browser_plugin_host) { | 19 browser_plugin_host_(browser_plugin_host) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 BrowserPluginHostHelper::~BrowserPluginHostHelper() { | 22 BrowserPluginHostHelper::~BrowserPluginHostHelper() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 | 25 |
| 26 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { | 26 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { |
| 27 bool handled = true; | 27 bool handled = true; |
| 28 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) | 28 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) |
| 29 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel, | 29 IPC_MESSAGE_HANDLER(OldBrowserPluginHostMsg_ConnectToChannel, |
| 30 OnConnectToChannel) | 30 OnConnectToChannel) |
| 31 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder, | 31 IPC_MESSAGE_HANDLER(OldBrowserPluginHostMsg_NavigateFromEmbedder, |
| 32 OnNavigateGuestFromEmbedder) | 32 OnNavigateGuestFromEmbedder) |
| 33 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) | 33 IPC_MESSAGE_HANDLER(OldBrowserPluginHostMsg_ResizeGuest, OnResizeGuest) |
| 34 IPC_MESSAGE_UNHANDLED(handled = false) | 34 IPC_MESSAGE_UNHANDLED(handled = false) |
| 35 IPC_END_MESSAGE_MAP() | 35 IPC_END_MESSAGE_MAP() |
| 36 return handled; | 36 return handled; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void BrowserPluginHostHelper::OnConnectToChannel( | 39 void BrowserPluginHostHelper::OnConnectToChannel( |
| 40 const IPC::ChannelHandle& channel_handle) { | 40 const IPC::ChannelHandle& channel_handle) { |
| 41 browser_plugin_host_->ConnectEmbedderToChannel( | 41 browser_plugin_host_->ConnectEmbedderToChannel( |
| 42 render_view_host(), | 42 render_view_host(), |
| 43 channel_handle); | 43 channel_handle); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( | 46 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( |
| 47 int32 instance_id, | 47 int32 instance_id, |
| 48 long long frame_id, | 48 long long frame_id, |
| 49 const std::string& src) { | 49 const std::string& src) { |
| 50 browser_plugin_host_->NavigateGuestFromEmbedder( | 50 browser_plugin_host_->NavigateGuestFromEmbedder( |
| 51 render_view_host(), | 51 render_view_host(), |
| 52 instance_id, | 52 instance_id, |
| 53 frame_id, | 53 frame_id, |
| 54 src); | 54 src); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { | 57 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { |
| 58 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); | 58 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| OLD | NEW |