OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/renderer_host/render_view_host_factory.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "chrome/browser/renderer_host/render_view_host.h" | |
9 | |
10 // static | |
11 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; | |
12 | |
13 // static | |
14 RenderViewHost* RenderViewHostFactory::Create( | |
15 SiteInstance* instance, | |
16 RenderViewHostDelegate* delegate, | |
17 int routing_id, | |
18 SessionStorageNamespace* session_storage_namespace) { | |
19 if (factory_) { | |
20 return factory_->CreateRenderViewHost(instance, delegate, routing_id, | |
21 session_storage_namespace); | |
22 } | |
23 return new RenderViewHost(instance, delegate, routing_id, | |
24 session_storage_namespace); | |
25 } | |
26 | |
27 // static | |
28 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { | |
29 DCHECK(!factory_) << "Can't register two factories at once."; | |
30 factory_ = factory; | |
31 } | |
32 | |
33 // static | |
34 void RenderViewHostFactory::UnregisterFactory() { | |
35 DCHECK(factory_) << "No factory to unregister."; | |
36 factory_ = NULL; | |
37 } | |
OLD | NEW |