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