Assume the foo_test_run depends on everything needed to run the test.
[chromium-blink-merge.git] / content / renderer / browser_plugin / browser_plugin_manager.cc
blob03120d82f7889fc70dd1dd958f89e788cdc2ace1
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.h"
7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h"
9 #include "content/public/renderer/render_thread.h"
10 #include "content/renderer/browser_plugin/browser_plugin.h"
11 #include "content/renderer/browser_plugin/browser_plugin_manager_factory.h"
12 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
14 namespace content {
16 // static
17 BrowserPluginManagerFactory* BrowserPluginManager::factory_ = NULL;
19 BrowserPluginManager* BrowserPluginManager::Create(
20 RenderViewImpl* render_view) {
21 if (factory_)
22 return factory_->CreateBrowserPluginManager(render_view);
23 return new BrowserPluginManagerImpl(render_view);
26 BrowserPluginManager::BrowserPluginManager(RenderViewImpl* render_view)
27 : RenderViewObserver(render_view),
28 render_view_(render_view->AsWeakPtr()) {
31 BrowserPluginManager::~BrowserPluginManager() {
34 void BrowserPluginManager::AddBrowserPlugin(
35 int guest_instance_id,
36 BrowserPlugin* browser_plugin) {
37 instances_.AddWithID(browser_plugin, guest_instance_id);
40 void BrowserPluginManager::RemoveBrowserPlugin(int guest_instance_id) {
41 instances_.Remove(guest_instance_id);
44 BrowserPlugin* BrowserPluginManager::GetBrowserPlugin(
45 int guest_instance_id) const {
46 return instances_.Lookup(guest_instance_id);
49 void BrowserPluginManager::UpdateDeviceScaleFactor(float device_scale_factor) {
50 IDMap<BrowserPlugin>::iterator iter(&instances_);
51 while (!iter.IsAtEnd()) {
52 iter.GetCurrentValue()->UpdateDeviceScaleFactor(device_scale_factor);
53 iter.Advance();
57 void BrowserPluginManager::UpdateFocusState() {
58 IDMap<BrowserPlugin>::iterator iter(&instances_);
59 while (!iter.IsAtEnd()) {
60 iter.GetCurrentValue()->UpdateGuestFocusState();
61 iter.Advance();
65 } // namespace content