summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/test_browser_plugin_embedder.cc
diff options
context:
space:
mode:
authorlazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 15:35:12 +0000
committerlazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 15:35:12 +0000
commit7f087fb3893209a9c1e34d9c3ebc04c74015576e (patch)
tree1ab1da1d2ec76e1e1f32da94c45aabb5352559a3 /content/browser/browser_plugin/test_browser_plugin_embedder.cc
parentef935ae14a48169f3b81a46f3ce0e9a5a88bc3c9 (diff)
downloadchromium_src-7f087fb3893209a9c1e34d9c3ebc04c74015576e.zip
chromium_src-7f087fb3893209a9c1e34d9c3ebc04c74015576e.tar.gz
chromium_src-7f087fb3893209a9c1e34d9c3ebc04c74015576e.tar.bz2
This is followup from Charlie's comments on Fady's cl: http://chromiumcodereview.appspot.com/10560022, it seems I cannot upload patch to that issue (since I'm not owner), I'm creating a new one.
Split Embedder and Guest 'roles' for browser plugin, web contents can now play any or both roles, main idea is to have more readable separation between the two. Also stop creating browser_plugin counterpart in browser/host for every web_contents, instead create them only when there's a browser_plugin element. BUG= 141232 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=157650 Review URL: https://chromiumcodereview.appspot.com/10868012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/test_browser_plugin_embedder.cc')
-rw-r--r--content/browser/browser_plugin/test_browser_plugin_embedder.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/content/browser/browser_plugin/test_browser_plugin_embedder.cc b/content/browser/browser_plugin/test_browser_plugin_embedder.cc
new file mode 100644
index 0000000..8d0ae8f
--- /dev/null
+++ b/content/browser/browser_plugin/test_browser_plugin_embedder.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/browser_plugin/test_browser_plugin_embedder.h"
+
+#include "base/time.h"
+#include "content/browser/browser_plugin/browser_plugin_embedder.h"
+#include "content/browser/browser_plugin/browser_plugin_guest.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/test/test_utils.h"
+
+namespace content {
+
+TestBrowserPluginEmbedder::TestBrowserPluginEmbedder(
+ WebContentsImpl* web_contents,
+ RenderViewHost* render_view_host)
+ : BrowserPluginEmbedder(web_contents, render_view_host) {
+}
+
+TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() {
+}
+
+void TestBrowserPluginEmbedder::AddGuest(int instance_id,
+ WebContents* guest_web_contents,
+ int64 frame_id) {
+ BrowserPluginEmbedder::AddGuest(instance_id, guest_web_contents, frame_id);
+ if (message_loop_runner_)
+ message_loop_runner_->Quit();
+}
+
+void TestBrowserPluginEmbedder::WaitForGuestAdded() {
+ // Check if guests were already created.
+ if (guest_web_contents_by_instance_id_.size() > 0)
+ return;
+ // Wait otherwise.
+ message_loop_runner_ = new MessageLoopRunner();
+ message_loop_runner_->Run();
+}
+
+} // namespace content