Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2991)

Unified Diff: content/renderer/browser_plugin/browser_plugin_manager.cc

Issue 617123005: Remove BrowserPlugin tests (only one test remaining with existing coverage) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_lifetime_explicit
Patch Set: More cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin_manager.cc
diff --git a/content/renderer/browser_plugin/browser_plugin_manager.cc b/content/renderer/browser_plugin/browser_plugin_manager.cc
index f5bd3976b03faee02ae69dc5117d2b9899b08b7b..fef04298ef54d56daae4881d478818eb8cccce39 100644
--- a/content/renderer/browser_plugin/browser_plugin_manager.cc
+++ b/content/renderer/browser_plugin/browser_plugin_manager.cc
@@ -4,27 +4,18 @@
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
-#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
-#include "base/threading/thread_local.h"
-#include "base/values.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
+#include "content/public/renderer/browser_plugin_delegate.h"
#include "content/public/renderer/render_thread.h"
#include "content/renderer/browser_plugin/browser_plugin.h"
-#include "content/renderer/browser_plugin/browser_plugin_manager_factory.h"
-#include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
namespace content {
// static
-BrowserPluginManagerFactory* BrowserPluginManager::factory_ = NULL;
-
-// static
BrowserPluginManager* BrowserPluginManager::Create(
RenderViewImpl* render_view) {
- if (factory_)
- return factory_->CreateBrowserPluginManager(render_view);
- return new BrowserPluginManagerImpl(render_view);
+ return new BrowserPluginManager(render_view);
}
BrowserPluginManager::BrowserPluginManager(RenderViewImpl* render_view)
@@ -77,4 +68,40 @@ void BrowserPluginManager::Attach(int browser_plugin_instance_id) {
plugin->Attach();
}
+BrowserPlugin* BrowserPluginManager::CreateBrowserPlugin(
+ RenderViewImpl* render_view,
+ blink::WebFrame* frame,
+ scoped_ptr<BrowserPluginDelegate> delegate) {
+ return new BrowserPlugin(render_view, frame, delegate.Pass());
+}
+
+void BrowserPluginManager::DidCommitCompositorFrame() {
+ IDMap<BrowserPlugin>::iterator iter(&instances_);
+ while (!iter.IsAtEnd()) {
+ iter.GetCurrentValue()->DidCommitCompositorFrame();
+ iter.Advance();
+ }
+}
+
+bool BrowserPluginManager::OnMessageReceived(
+ const IPC::Message& message) {
+ if (BrowserPlugin::ShouldForwardToBrowserPlugin(message)) {
+ int browser_plugin_instance_id = browser_plugin::kInstanceIDNone;
+ // All allowed messages must have |browser_plugin_instance_id| as their
+ // first parameter.
+ PickleIterator iter(message);
+ bool success = iter.ReadInt(&browser_plugin_instance_id);
+ DCHECK(success);
+ BrowserPlugin* plugin = GetBrowserPlugin(browser_plugin_instance_id);
+ if (plugin && plugin->OnMessageReceived(message))
+ return true;
+ }
+
+ return false;
+}
+
+bool BrowserPluginManager::Send(IPC::Message* msg) {
+ return RenderThread::Get()->Send(msg);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698