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 #include "content/browser/renderer_host/render_view_host_factory.h" | 5 #include "content/browser/renderer_host/render_view_host_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 | 9 |
10 using content::RenderViewHost; | 10 namespace content { |
11 using content::RenderViewHostImpl; | |
12 using content::SessionStorageNamespace; | |
13 using content::SiteInstance; | |
14 | 11 |
15 // static | 12 // static |
16 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; | 13 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; |
17 | 14 |
18 // static | 15 // static |
19 RenderViewHost* RenderViewHostFactory::Create( | 16 RenderViewHost* RenderViewHostFactory::Create( |
20 SiteInstance* instance, | 17 SiteInstance* instance, |
21 content::RenderViewHostDelegate* delegate, | 18 RenderViewHostDelegate* delegate, |
22 content::RenderWidgetHostDelegate* widget_delegate, | 19 RenderWidgetHostDelegate* widget_delegate, |
23 int routing_id, | 20 int routing_id, |
24 bool swapped_out, | 21 bool swapped_out, |
25 SessionStorageNamespace* session_storage_namespace) { | 22 SessionStorageNamespace* session_storage_namespace) { |
26 if (factory_) { | 23 if (factory_) { |
27 return factory_->CreateRenderViewHost(instance, delegate, widget_delegate, | 24 return factory_->CreateRenderViewHost(instance, delegate, widget_delegate, |
28 routing_id, swapped_out, | 25 routing_id, swapped_out, |
29 session_storage_namespace); | 26 session_storage_namespace); |
30 } | 27 } |
31 return new RenderViewHostImpl(instance, delegate, widget_delegate, routing_id, | 28 return new RenderViewHostImpl(instance, delegate, widget_delegate, routing_id, |
32 swapped_out, session_storage_namespace); | 29 swapped_out, session_storage_namespace); |
33 } | 30 } |
34 | 31 |
35 // static | 32 // static |
36 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { | 33 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { |
37 DCHECK(!factory_) << "Can't register two factories at once."; | 34 DCHECK(!factory_) << "Can't register two factories at once."; |
38 factory_ = factory; | 35 factory_ = factory; |
39 } | 36 } |
40 | 37 |
41 // static | 38 // static |
42 void RenderViewHostFactory::UnregisterFactory() { | 39 void RenderViewHostFactory::UnregisterFactory() { |
43 DCHECK(factory_) << "No factory to unregister."; | 40 DCHECK(factory_) << "No factory to unregister."; |
44 factory_ = NULL; | 41 factory_ = NULL; |
45 } | 42 } |
| 43 |
| 44 } // namespace content |
OLD | NEW |