OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" | 5 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" |
6 | 6 |
7 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 7 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 TestBrowserPluginEmbedder::TestBrowserPluginEmbedder( | 12 TestBrowserPluginEmbedder::TestBrowserPluginEmbedder( |
13 WebContentsImpl* web_contents) | 13 WebContentsImpl* web_contents) |
14 : BrowserPluginEmbedder(web_contents), | 14 : BrowserPluginEmbedder(web_contents), |
15 last_rvh_at_position_response_(NULL) { | 15 last_rvh_at_position_response_(NULL) { |
16 } | 16 } |
17 | 17 |
18 TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() { | 18 TestBrowserPluginEmbedder::~TestBrowserPluginEmbedder() { |
19 } | 19 } |
20 | 20 |
21 void TestBrowserPluginEmbedder::GetRenderViewHostCallback( | 21 void TestBrowserPluginEmbedder::GetRenderViewHostCallback( |
22 RenderViewHost* rvh, int x, int y) { | 22 RenderViewHost* rvh, int x, int y) { |
23 last_rvh_at_position_response_ = rvh; | 23 last_rvh_at_position_response_ = rvh; |
24 if (message_loop_runner_) | 24 if (message_loop_runner_.get()) |
25 message_loop_runner_->Quit(); | 25 message_loop_runner_->Quit(); |
26 } | 26 } |
27 | 27 |
28 void TestBrowserPluginEmbedder::WaitForRenderViewHostAtPosition(int x, int y) { | 28 void TestBrowserPluginEmbedder::WaitForRenderViewHostAtPosition(int x, int y) { |
29 GetRenderViewHostAtPosition(x, y, | 29 GetRenderViewHostAtPosition(x, y, |
30 base::Bind(&TestBrowserPluginEmbedder::GetRenderViewHostCallback, | 30 base::Bind(&TestBrowserPluginEmbedder::GetRenderViewHostCallback, |
31 base::Unretained(this))); | 31 base::Unretained(this))); |
32 message_loop_runner_ = new MessageLoopRunner(); | 32 message_loop_runner_ = new MessageLoopRunner(); |
33 message_loop_runner_->Run(); | 33 message_loop_runner_->Run(); |
34 } | 34 } |
35 | 35 |
36 WebContentsImpl* TestBrowserPluginEmbedder::web_contents() const { | 36 WebContentsImpl* TestBrowserPluginEmbedder::web_contents() const { |
37 return static_cast<WebContentsImpl*>(BrowserPluginEmbedder::web_contents()); | 37 return static_cast<WebContentsImpl*>(BrowserPluginEmbedder::web_contents()); |
38 } | 38 } |
39 | 39 |
40 } // namespace content | 40 } // namespace content |
OLD | NEW |