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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 int32_t routing_id, | 32 int32_t routing_id, |
33 int32_t main_frame_routing_id, | 33 int32_t main_frame_routing_id, |
34 bool swapped_out, | 34 bool swapped_out, |
35 bool hidden); | 35 bool hidden); |
36 | 36 |
37 // Returns true if there is currently a globally-registered factory. | 37 // Returns true if there is currently a globally-registered factory. |
38 static bool has_factory() { | 38 static bool has_factory() { |
39 return !!factory_; | 39 return !!factory_; |
40 } | 40 } |
41 | 41 |
42 // Returns true if it is safe to allow a cast to RenderWidgetHostViewAura in | |
43 // a test. This defaults to false. | |
44 CONTENT_EXPORT static bool allow_host_view_cast_in_test() { | |
45 return allow_host_view_cast_in_test_; | |
46 } | |
47 | |
48 // Sets the allow_host_view_cast_in_test_ flag which indicates that it is ok | |
49 // to cast a view to RenderWidgetHostViewAura in a test. | |
50 CONTENT_EXPORT static void set_allow_host_view_cast_in_test( | |
51 bool allow_cast) { | |
52 allow_host_view_cast_in_test_ = allow_cast; | |
53 } | |
54 | |
42 protected: | 55 protected: |
43 RenderViewHostFactory() {} | 56 RenderViewHostFactory() {} |
44 virtual ~RenderViewHostFactory() {} | 57 virtual ~RenderViewHostFactory() {} |
45 | 58 |
46 // You can derive from this class and specify an implementation for this | 59 // You can derive from this class and specify an implementation for this |
47 // function to create a different kind of RenderViewHost for testing. | 60 // function to create a different kind of RenderViewHost for testing. |
48 virtual RenderViewHost* CreateRenderViewHost( | 61 virtual RenderViewHost* CreateRenderViewHost( |
49 SiteInstance* instance, | 62 SiteInstance* instance, |
50 RenderViewHostDelegate* delegate, | 63 RenderViewHostDelegate* delegate, |
51 RenderWidgetHostDelegate* widget_delegate, | 64 RenderWidgetHostDelegate* widget_delegate, |
52 int32_t routing_id, | 65 int32_t routing_id, |
53 int32_t main_frame_routing_id, | 66 int32_t main_frame_routing_id, |
54 bool swapped_out) = 0; | 67 bool swapped_out) = 0; |
55 | 68 |
56 // Registers your factory to be called when new RenderViewHosts are created. | 69 // Registers your factory to be called when new RenderViewHosts are created. |
57 // We have only one global factory, so there must be no factory registered | 70 // We have only one global factory, so there must be no factory registered |
58 // before the call. This class does NOT take ownership of the pointer. | 71 // before the call. This class does NOT take ownership of the pointer. |
59 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); | 72 CONTENT_EXPORT static void RegisterFactory(RenderViewHostFactory* factory); |
60 | 73 |
61 // Unregister the previously registered factory. With no factory registered, | 74 // Unregister the previously registered factory. With no factory registered, |
62 // the default RenderViewHosts will be created. | 75 // the default RenderViewHosts will be created. |
63 CONTENT_EXPORT static void UnregisterFactory(); | 76 CONTENT_EXPORT static void UnregisterFactory(); |
64 | 77 |
65 private: | 78 private: |
66 // The current globally registered factory. This is NULL when we should | 79 // The current globally registered factory. This is NULL when we should |
67 // create the default RenderViewHosts. | 80 // create the default RenderViewHosts. |
68 CONTENT_EXPORT static RenderViewHostFactory* factory_; | 81 CONTENT_EXPORT static RenderViewHostFactory* factory_; |
69 | 82 |
83 // Set to true if we a RenderWidgetHostView pointer can be casted to | |
tdresser
2016/01/21 15:40:27
Fix "if we a"
ananta
2016/01/21 21:11:18
Done.
| |
84 // RenderWidgetHostViewAura in a test. Defaults to false. | |
85 CONTENT_EXPORT static bool allow_host_view_cast_in_test_; | |
86 | |
70 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); | 87 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); |
71 }; | 88 }; |
72 | 89 |
73 } // namespace content | 90 } // namespace content |
74 | 91 |
75 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ | 92 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ |
OLD | NEW |