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 #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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 // Creates a RenderViewHost using the currently registered factory, or the | 23 // Creates a RenderViewHost using the currently registered factory, or the |
24 // default one if no factory is registered. Ownership of the returned | 24 // default one if no factory is registered. Ownership of the returned |
25 // pointer will be passed to the caller. | 25 // pointer will be passed to the caller. |
26 static RenderViewHost* Create( | 26 static RenderViewHost* Create( |
27 SiteInstance* instance, | 27 SiteInstance* instance, |
28 RenderViewHostDelegate* delegate, | 28 RenderViewHostDelegate* delegate, |
29 RenderWidgetHostDelegate* widget_delegate, | 29 RenderWidgetHostDelegate* widget_delegate, |
30 int routing_id, | 30 int routing_id, |
31 int main_frame_routing_id, | 31 int main_frame_routing_id, |
32 bool swapped_out, | 32 bool swapped_out); |
33 SessionStorageNamespace* session_storage); | |
34 | 33 |
35 // Returns true if there is currently a globally-registered factory. | 34 // Returns true if there is currently a globally-registered factory. |
36 static bool has_factory() { | 35 static bool has_factory() { |
37 return !!factory_; | 36 return !!factory_; |
38 } | 37 } |
39 | 38 |
40 protected: | 39 protected: |
41 RenderViewHostFactory() {} | 40 RenderViewHostFactory() {} |
42 virtual ~RenderViewHostFactory() {} | 41 virtual ~RenderViewHostFactory() {} |
43 | 42 |
44 // You can derive from this class and specify an implementation for this | 43 // You can derive from this class and specify an implementation for this |
45 // function to create a different kind of RenderViewHost for testing. | 44 // function to create a different kind of RenderViewHost for testing. |
46 virtual RenderViewHost* CreateRenderViewHost( | 45 virtual RenderViewHost* CreateRenderViewHost( |
47 SiteInstance* instance, | 46 SiteInstance* instance, |
48 RenderViewHostDelegate* delegate, | 47 RenderViewHostDelegate* delegate, |
49 RenderWidgetHostDelegate* widget_delegate, | 48 RenderWidgetHostDelegate* widget_delegate, |
50 int routing_id, | 49 int routing_id, |
51 int main_frame_routing_id, | 50 int main_frame_routing_id, |
52 bool swapped_out, | 51 bool swapped_out) = 0; |
53 SessionStorageNamespace* session_storage_namespace) = 0; | |
54 | 52 |
55 // Registers your factory to be called when new RenderViewHosts are created. | 53 // Registers your factory to be called when new RenderViewHosts are created. |
56 // We have only one global factory, so there must be no factory registered | 54 // We have only one global factory, so there must be no factory registered |
57 // before the call. This class does NOT take ownership of the pointer. | 55 // before the call. This class does NOT take ownership of the pointer. |
58 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); | 56 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); |
59 | 57 |
60 // Unregister the previously registered factory. With no factory registered, | 58 // Unregister the previously registered factory. With no factory registered, |
61 // the default RenderViewHosts will be created. | 59 // the default RenderViewHosts will be created. |
62 CONTENT_EXPORT static void UnregisterFactory(); | 60 CONTENT_EXPORT static void UnregisterFactory(); |
63 | 61 |
64 private: | 62 private: |
65 // The current globally registered factory. This is NULL when we should | 63 // The current globally registered factory. This is NULL when we should |
66 // create the default RenderViewHosts. | 64 // create the default RenderViewHosts. |
67 CONTENT_EXPORT static RenderViewHostFactory* factory_; | 65 CONTENT_EXPORT static RenderViewHostFactory* factory_; |
68 | 66 |
69 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); | 67 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); |
70 }; | 68 }; |
71 | 69 |
72 } // namespace content | 70 } // namespace content |
73 | 71 |
74 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ | 72 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ |
OLD | NEW |