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

Side by Side Diff: content/renderer/browser_plugin/mock_browser_plugin_manager.cc

Issue 21930006: <webview>: Allocate the view instance ID from the WebView shim (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « content/renderer/browser_plugin/mock_browser_plugin_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 browser_plugin_instance_id_counter_(0),
18 guest_instance_id_counter_(0) { 17 guest_instance_id_counter_(0) {
19 } 18 }
20 19
21 MockBrowserPluginManager::~MockBrowserPluginManager() { 20 MockBrowserPluginManager::~MockBrowserPluginManager() {
22 } 21 }
23 22
24 BrowserPlugin* MockBrowserPluginManager::CreateBrowserPlugin( 23 BrowserPlugin* MockBrowserPluginManager::CreateBrowserPlugin(
25 RenderViewImpl* render_view, 24 RenderViewImpl* render_view,
26 WebKit::WebFrame* frame, 25 WebKit::WebFrame* frame,
27 const WebKit::WebPluginParams& params) { 26 const WebKit::WebPluginParams& params) {
28 int instance_id = ++browser_plugin_instance_id_counter_; 27 return new MockBrowserPlugin(render_view, frame, params);
29 return new MockBrowserPlugin(render_view, frame, params, instance_id);
30 } 28 }
31 29
32 void MockBrowserPluginManager::AllocateInstanceID( 30 void MockBrowserPluginManager::AllocateInstanceID(
33 BrowserPlugin* browser_plugin) { 31 BrowserPlugin* browser_plugin) {
34 int guest_instance_id = ++guest_instance_id_counter_; 32 int guest_instance_id = ++guest_instance_id_counter_;
35 base::MessageLoop::current()->PostTask( 33 base::MessageLoop::current()->PostTask(
36 FROM_HERE, 34 FROM_HERE,
37 base::Bind(&MockBrowserPluginManager::AllocateInstanceIDACK, 35 base::Bind(&MockBrowserPluginManager::AllocateInstanceIDACK,
38 this, 36 this,
39 base::Unretained(browser_plugin), 37 base::Unretained(browser_plugin),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 70 }
73 71
74 bool MockBrowserPluginManager::OnMessageReceived( 72 bool MockBrowserPluginManager::OnMessageReceived(
75 const IPC::Message& message) { 73 const IPC::Message& message) {
76 // Save the message in the sink. 74 // Save the message in the sink.
77 sink_.OnMessageReceived(message); 75 sink_.OnMessageReceived(message);
78 return false; 76 return false;
79 } 77 }
80 78
81 } // namespace content 79 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/mock_browser_plugin_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698