Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / browser_plugin / browser_plugin_manager_impl.cc
blob8ada74e62c16343ae96c63f586b95aa1ac568766
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"
14 namespace content {
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,
26 bool auto_navigate) {
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 browser_plugin_instance_id = browser_plugin::kInstanceIDNone;
38 // All allowed messages must have |browser_plugin_instance_id| as their
39 // first parameter.
40 PickleIterator iter(message);
41 bool success = iter.ReadInt(&browser_plugin_instance_id);
42 DCHECK(success);
43 BrowserPlugin* plugin = GetBrowserPlugin(browser_plugin_instance_id);
44 if (plugin && plugin->OnMessageReceived(message))
45 return true;
48 return false;
51 void BrowserPluginManagerImpl::DidCommitCompositorFrame() {
52 IDMap<BrowserPlugin>::iterator iter(&instances_);
53 while (!iter.IsAtEnd()) {
54 iter.GetCurrentValue()->DidCommitCompositorFrame();
55 iter.Advance();
59 } // namespace content