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