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