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