Chromium Code Reviews| 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; | |
|
jam
2012/03/05 23:59:28
nit: also the impl?
Jói
2012/03/06 16:38:55
Done.
| |
| 10 using content::SessionStorageNamespace; | 11 using content::SessionStorageNamespace; |
| 11 using content::SiteInstance; | 12 using content::SiteInstance; |
| 12 | 13 |
| 13 // static | 14 // static |
| 14 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; | 15 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 RenderViewHost* RenderViewHostFactory::Create( | 18 RenderViewHost* RenderViewHostFactory::Create( |
| 18 SiteInstance* instance, | 19 SiteInstance* instance, |
| 19 content::RenderViewHostDelegate* delegate, | 20 content::RenderViewHostDelegate* delegate, |
| 20 int routing_id, | 21 int routing_id, |
| 21 SessionStorageNamespace* session_storage_namespace) { | 22 SessionStorageNamespace* session_storage_namespace) { |
| 22 if (factory_) { | 23 if (factory_) { |
| 23 return factory_->CreateRenderViewHost(instance, delegate, routing_id, | 24 return factory_->CreateRenderViewHost(instance, delegate, routing_id, |
| 24 session_storage_namespace); | 25 session_storage_namespace); |
| 25 } | 26 } |
| 26 return new RenderViewHostImpl(instance, delegate, routing_id, | 27 return new content::RenderViewHostImpl(instance, delegate, routing_id, |
| 27 session_storage_namespace); | 28 session_storage_namespace); |
| 28 } | 29 } |
| 29 | 30 |
| 30 // static | 31 // static |
| 31 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { | 32 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { |
| 32 DCHECK(!factory_) << "Can't register two factories at once."; | 33 DCHECK(!factory_) << "Can't register two factories at once."; |
| 33 factory_ = factory; | 34 factory_ = factory; |
| 34 } | 35 } |
| 35 | 36 |
| 36 // static | 37 // static |
| 37 void RenderViewHostFactory::UnregisterFactory() { | 38 void RenderViewHostFactory::UnregisterFactory() { |
| 38 DCHECK(factory_) << "No factory to unregister."; | 39 DCHECK(factory_) << "No factory to unregister."; |
| 39 factory_ = NULL; | 40 factory_ = NULL; |
| 40 } | 41 } |
| OLD | NEW |