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