| 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/renderer/browser_plugin/mock_browser_plugin_manager.h" | 5 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "content/common/browser_plugin/browser_plugin_messages.h" | 8 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 9 #include "content/renderer/browser_plugin/mock_browser_plugin.h" | 9 #include "content/renderer/browser_plugin/mock_browser_plugin.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 MockBrowserPluginManager::MockBrowserPluginManager( | 14 MockBrowserPluginManager::MockBrowserPluginManager( |
| 15 RenderViewImpl* render_view) | 15 RenderViewImpl* render_view) |
| 16 : BrowserPluginManager(render_view), | 16 : BrowserPluginManager(render_view), |
| 17 last_plugin_(NULL) { | 17 last_plugin_(NULL) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 MockBrowserPluginManager::~MockBrowserPluginManager() { | 20 MockBrowserPluginManager::~MockBrowserPluginManager() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 BrowserPlugin* MockBrowserPluginManager::CreateBrowserPlugin( | 23 BrowserPlugin* MockBrowserPluginManager::CreateBrowserPlugin( |
| 24 RenderViewImpl* render_view, | 24 RenderViewImpl* render_view, |
| 25 blink::WebFrame* frame, | 25 blink::WebFrame* frame, |
| 26 bool auto_navigate) { | 26 scoped_ptr<BrowserPluginDelegate> delegate) { |
| 27 last_plugin_ = new MockBrowserPlugin(render_view, frame, auto_navigate); | 27 last_plugin_ = new MockBrowserPlugin(render_view, frame, delegate.Pass()); |
| 28 return last_plugin_; | 28 return last_plugin_; |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool MockBrowserPluginManager::Send(IPC::Message* msg) { | 31 bool MockBrowserPluginManager::Send(IPC::Message* msg) { |
| 32 // This is a copy-and-paste from MockRenderThread::Send. | 32 // This is a copy-and-paste from MockRenderThread::Send. |
| 33 // We need to simulate a synchronous channel, thus we are going to receive | 33 // We need to simulate a synchronous channel, thus we are going to receive |
| 34 // through this function messages, messages with reply and reply messages. | 34 // through this function messages, messages with reply and reply messages. |
| 35 // We can only handle one synchronous message at a time. | 35 // We can only handle one synchronous message at a time. |
| 36 if (msg->is_reply()) { | 36 if (msg->is_reply()) { |
| 37 if (reply_deserializer_) { | 37 if (reply_deserializer_) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool MockBrowserPluginManager::OnMessageReceived( | 54 bool MockBrowserPluginManager::OnMessageReceived( |
| 55 const IPC::Message& message) { | 55 const IPC::Message& message) { |
| 56 // Save the message in the sink. | 56 // Save the message in the sink. |
| 57 sink_.OnMessageReceived(message); | 57 sink_.OnMessageReceived(message); |
| 58 return false; | 58 return false; |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| OLD | NEW |