Revert of Class for allocating a chunk of memory for RenderPass (patchset #31 id...
[chromium-blink-merge.git] / content / renderer / browser_plugin / browser_plugin_manager_impl.cc
blob8f1b9b046b5c3afd82736205a93f72b6ba78ea96
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/public/renderer/browser_plugin_delegate.h"
11 #include "content/renderer/browser_plugin/browser_plugin.h"
12 #include "content/renderer/render_thread_impl.h"
13 #include "ui/gfx/point.h"
15 namespace content {
17 BrowserPluginManagerImpl::BrowserPluginManagerImpl(RenderViewImpl* render_view)
18 : BrowserPluginManager(render_view) {
21 BrowserPluginManagerImpl::~BrowserPluginManagerImpl() {
24 BrowserPlugin* BrowserPluginManagerImpl::CreateBrowserPlugin(
25 RenderViewImpl* render_view,
26 blink::WebFrame* frame,
27 scoped_ptr<BrowserPluginDelegate> delegate) {
28 return new BrowserPlugin(render_view, frame, delegate.Pass());
31 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) {
32 return RenderThread::Get()->Send(msg);
35 bool BrowserPluginManagerImpl::OnMessageReceived(
36 const IPC::Message& message) {
37 if (BrowserPlugin::ShouldForwardToBrowserPlugin(message)) {
38 int browser_plugin_instance_id = browser_plugin::kInstanceIDNone;
39 // All allowed messages must have |browser_plugin_instance_id| as their
40 // first parameter.
41 PickleIterator iter(message);
42 bool success = iter.ReadInt(&browser_plugin_instance_id);
43 DCHECK(success);
44 BrowserPlugin* plugin = GetBrowserPlugin(browser_plugin_instance_id);
45 if (plugin && plugin->OnMessageReceived(message))
46 return true;
49 return false;
52 void BrowserPluginManagerImpl::DidCommitCompositorFrame() {
53 IDMap<BrowserPlugin>::iterator iter(&instances_);
54 while (!iter.IsAtEnd()) {
55 iter.GetCurrentValue()->DidCommitCompositorFrame();
56 iter.Advance();
60 } // namespace content