Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_host_helper.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_host_helper.cc b/content/browser/browser_plugin/browser_plugin_host_helper.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c33db905b18d3c2735b2b9f168d83f50e9a6152 |
| --- /dev/null |
| +++ b/content/browser/browser_plugin/browser_plugin_host_helper.cc |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/browser_plugin/browser_plugin_host_helper.h" |
| + |
| +#include "content/browser/browser_plugin/browser_plugin_host.h" |
| +#include "content/common/browser_plugin_messages.h" |
| +#include "content/public/browser/render_view_host.h" |
| +#include "content/public/browser/render_widget_host_view.h" |
| +#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.
|
| +#include "ui/gfx/size.h" |
| + |
| +namespace content { |
| + |
| +BrowserPluginHostHelper::BrowserPluginHostHelper( |
| + BrowserPluginHost* browser_plugin_host, |
| + RenderViewHost* render_view_host) |
| + : RenderViewHostObserver(render_view_host), |
| + browser_plugin_host_(browser_plugin_host) { |
| +} |
| + |
| +BrowserPluginHostHelper::~BrowserPluginHostHelper() { |
| +} |
| + |
| + |
| +bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { |
| + bool handled = true; |
| + IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) |
| + IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel, |
| + OnConnectToChannel) |
| + IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder, |
| + OnNavigateGuestFromEmbedder) |
| + IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
| + IPC_END_MESSAGE_MAP() |
| + return handled; |
| +} |
| + |
| +void BrowserPluginHostHelper::OnConnectToChannel( |
| + const IPC::ChannelHandle& channel_handle) { |
| + browser_plugin_host_->ConnectEmbedderToChannel( |
| + render_view_host(), |
| + channel_handle); |
| +} |
| + |
| +void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( |
| + int32 instance_id, |
| + long long frame_id, |
| + const std::string& src, |
| + const gfx::Size& size) { |
| + browser_plugin_host_->NavigateGuestFromEmbedder( |
| + render_view_host(), |
| + instance_id, |
| + frame_id, |
| + src, |
| + size); |
| +} |
| + |
| +void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { |
| + 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.
|
| + render_view_host()->GetView()->SetSize(gfx::Size(width, height)); |
| +} |
| + |
| +} // namespace content |