| 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 "chrome/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 "chrome/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 int64 session_storage_namespace_id) { |
| 18 if (factory_) { | 19 if (factory_) { |
| 19 return factory_->CreateRenderViewHost(instance, delegate, routing_id); | 20 return factory_->CreateRenderViewHost(instance, delegate, routing_id, |
| 21 session_storage_namespace_id); |
| 20 } | 22 } |
| 21 return new RenderViewHost(instance, delegate, routing_id); | 23 return new RenderViewHost(instance, delegate, routing_id, |
| 24 session_storage_namespace_id); |
| 22 } | 25 } |
| 23 | 26 |
| 24 // static | 27 // static |
| 25 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { | 28 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { |
| 26 DCHECK(!factory_) << "Can't register two factories at once."; | 29 DCHECK(!factory_) << "Can't register two factories at once."; |
| 27 factory_ = factory; | 30 factory_ = factory; |
| 28 } | 31 } |
| 29 | 32 |
| 30 // static | 33 // static |
| 31 void RenderViewHostFactory::UnregisterFactory() { | 34 void RenderViewHostFactory::UnregisterFactory() { |
| 32 DCHECK(factory_) << "No factory to unregister."; | 35 DCHECK(factory_) << "No factory to unregister."; |
| 33 factory_ = NULL; | 36 factory_ = NULL; |
| 34 } | 37 } |
| OLD | NEW |