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.
5 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
7 #include "content/common/browser_plugin/browser_plugin_constants.h"
8 #include "content/common/browser_plugin/browser_plugin_messages.h"
9 #include "content/common/cursors/webcursor.h"
10 #include "content/renderer/browser_plugin/browser_plugin.h"
11 #include "content/renderer/render_thread_impl.h"
12 #include "ui/gfx/point.h"
16 BrowserPluginManagerImpl::BrowserPluginManagerImpl(RenderViewImpl* render_view)
17 : BrowserPluginManager(render_view) {
20 BrowserPluginManagerImpl::~BrowserPluginManagerImpl() {
23 BrowserPlugin* BrowserPluginManagerImpl::CreateBrowserPlugin(
24 RenderViewImpl* render_view,
25 blink::WebFrame* frame,
27 return new BrowserPlugin(render_view, frame, auto_navigate);
30 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) {
31 return RenderThread::Get()->Send(msg);
34 bool BrowserPluginManagerImpl::OnMessageReceived(
35 const IPC::Message& message) {
36 if (BrowserPlugin::ShouldForwardToBrowserPlugin(message)) {
37 int guest_instance_id = browser_plugin::kInstanceIDNone;
38 // All allowed messages must have |guest_instance_id| as their first
40 PickleIterator iter(message);
41 bool success = iter.ReadInt(&guest_instance_id);
43 BrowserPlugin* plugin = GetBrowserPlugin(guest_instance_id);
44 if (plugin && plugin->OnMessageReceived(message))
51 void BrowserPluginManagerImpl::DidCommitCompositorFrame() {
52 IDMap<BrowserPlugin>::iterator iter(&instances_);
53 while (!iter.IsAtEnd()) {
54 iter.GetCurrentValue()->DidCommitCompositorFrame();
59 } // namespace content