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

Side by Side Diff: content/browser/renderer_host/render_view_host_factory.h

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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 | Annotate | Revision Log
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_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 namespace content {
12 class RenderViewHost; 13 class RenderViewHost;
13
14 namespace content {
15 class RenderViewHostDelegate; 14 class RenderViewHostDelegate;
16 class SessionStorageNamespace; 15 class SessionStorageNamespace;
17 class SiteInstance; 16 class SiteInstance;
18 } 17 }
19 18
20 // A factory for creating RenderViewHosts. There is a global factory function 19 // A factory for creating RenderViewHosts. There is a global factory function
21 // that can be installed for the purposes of testing to provide a specialized 20 // that can be installed for the purposes of testing to provide a specialized
22 // RenderViewHost class. 21 // RenderViewHost class.
23 class RenderViewHostFactory { 22 class RenderViewHostFactory {
24 public: 23 public:
25 // Creates a RenderViewHost using the currently registered factory, or the 24 // Creates a RenderViewHost using the currently registered factory, or the
26 // default one if no factory is registered. Ownership of the returned 25 // default one if no factory is registered. Ownership of the returned
27 // pointer will be passed to the caller. 26 // pointer will be passed to the caller.
28 static RenderViewHost* Create( 27 static content::RenderViewHost* Create(
29 content::SiteInstance* instance, 28 content::SiteInstance* instance,
30 content::RenderViewHostDelegate* delegate, 29 content::RenderViewHostDelegate* delegate,
31 int routing_id, 30 int routing_id,
32 content::SessionStorageNamespace* session_storage); 31 content::SessionStorageNamespace* session_storage);
33 32
34 // Returns true if there is currently a globally-registered factory. 33 // Returns true if there is currently a globally-registered factory.
35 static bool has_factory() { 34 static bool has_factory() {
36 return !!factory_; 35 return !!factory_;
37 } 36 }
38 37
39 protected: 38 protected:
40 RenderViewHostFactory() {} 39 RenderViewHostFactory() {}
41 virtual ~RenderViewHostFactory() {} 40 virtual ~RenderViewHostFactory() {}
42 41
43 // You can derive from this class and specify an implementation for this 42 // You can derive from this class and specify an implementation for this
44 // function to create a different kind of RenderViewHost for testing. 43 // function to create a different kind of RenderViewHost for testing.
45 virtual RenderViewHost* CreateRenderViewHost( 44 virtual content::RenderViewHost* CreateRenderViewHost(
46 content::SiteInstance* instance, 45 content::SiteInstance* instance,
47 content::RenderViewHostDelegate* delegate, 46 content::RenderViewHostDelegate* delegate,
48 int routing_id, 47 int routing_id,
49 content::SessionStorageNamespace* session_storage_namespace) = 0; 48 content::SessionStorageNamespace* session_storage_namespace) = 0;
50 49
51 // Registers your factory to be called when new RenderViewHosts are created. 50 // Registers your factory to be called when new RenderViewHosts are created.
52 // We have only one global factory, so there must be no factory registered 51 // We have only one global factory, so there must be no factory registered
53 // before the call. This class does NOT take ownership of the pointer. 52 // before the call. This class does NOT take ownership of the pointer.
54 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); 53 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory);
55 54
56 // Unregister the previously registered factory. With no factory registered, 55 // Unregister the previously registered factory. With no factory registered,
57 // the default RenderViewHosts will be created. 56 // the default RenderViewHosts will be created.
58 CONTENT_EXPORT static void UnregisterFactory(); 57 CONTENT_EXPORT static void UnregisterFactory();
59 58
60 private: 59 private:
61 // The current globally registered factory. This is NULL when we should 60 // The current globally registered factory. This is NULL when we should
62 // create the default RenderViewHosts. 61 // create the default RenderViewHosts.
63 CONTENT_EXPORT static RenderViewHostFactory* factory_; 62 CONTENT_EXPORT static RenderViewHostFactory* factory_;
64 63
65 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); 64 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory);
66 }; 65 };
67 66
68 67
69 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 68 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698