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

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

Issue 299753011: Move allocate instance id to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HasPermission function moved Created 6 years, 6 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
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 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_
7 7
8 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 8 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ipc/ipc_message_utils.h" 11 #include "ipc/ipc_message_utils.h"
12 #include "ipc/ipc_test_sink.h" 12 #include "ipc/ipc_test_sink.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class MockBrowserPlugin;
17
16 class MockBrowserPluginManager : public BrowserPluginManager { 18 class MockBrowserPluginManager : public BrowserPluginManager {
17 public: 19 public:
18 MockBrowserPluginManager(RenderViewImpl* render_view); 20 MockBrowserPluginManager(RenderViewImpl* render_view);
19 21
20 // BrowserPluginManager implementation. 22 // BrowserPluginManager implementation.
21 virtual BrowserPlugin* CreateBrowserPlugin( 23 virtual BrowserPlugin* CreateBrowserPlugin(
22 RenderViewImpl* render_view, 24 RenderViewImpl* render_view,
23 blink::WebFrame* frame, 25 blink::WebFrame* frame,
24 bool auto_navigate) OVERRIDE; 26 bool auto_navigate) OVERRIDE;
25 virtual void AllocateInstanceID(
26 const base::WeakPtr<BrowserPlugin>& browser_plugin) OVERRIDE;
27 27
28 // Provides access to the messages that have been received by this thread. 28 // Provides access to the messages that have been received by this thread.
29 IPC::TestSink& sink() { return sink_; } 29 IPC::TestSink& sink() { return sink_; }
30 30
31 // Allocates instance ID for the browser plugin.
32 void AllocateInstanceID(BrowserPlugin* browser_plugin);
33
31 // RenderViewObserver override. 34 // RenderViewObserver override.
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
33 virtual bool Send(IPC::Message* msg) OVERRIDE; 36 virtual bool Send(IPC::Message* msg) OVERRIDE;
37
38 // Returns the latest browser plugin that was created by this manager.
39 MockBrowserPlugin* last_plugin() { return last_plugin_; }
40
34 protected: 41 protected:
35 virtual ~MockBrowserPluginManager(); 42 virtual ~MockBrowserPluginManager();
36 void AllocateInstanceIDACK(BrowserPlugin* browser_plugin, 43 void AllocateInstanceIDACK(BrowserPlugin* browser_plugin,
37 int guest_instance_id); 44 int guest_instance_id);
38 45
39 IPC::TestSink sink_; 46 IPC::TestSink sink_;
40 47
41 // The last known good deserializer for sync messages. 48 // The last known good deserializer for sync messages.
42 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; 49 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_;
43 50
44 int guest_instance_id_counter_; 51 int guest_instance_id_counter_;
52 MockBrowserPlugin* last_plugin_;
45 53
46 DISALLOW_COPY_AND_ASSIGN(MockBrowserPluginManager); 54 DISALLOW_COPY_AND_ASSIGN(MockBrowserPluginManager);
47 }; 55 };
48 56
49 } // namespace content 57 } // namespace content
50 58
51 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_ 59 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698