Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / browser / renderer_host / render_view_host_factory.cc
blob0b2edf21f0d6c27719d8ac82a70ced8ac05c368a
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
3 // found in the LICENSE file.
5 #include "content/browser/renderer_host/render_view_host_factory.h"
7 #include "base/logging.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h"
10 namespace content {
12 // static
13 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL;
15 // static
16 RenderViewHost* RenderViewHostFactory::Create(
17 SiteInstance* instance,
18 RenderViewHostDelegate* delegate,
19 RenderWidgetHostDelegate* widget_delegate,
20 int routing_id,
21 int main_frame_routing_id,
22 bool swapped_out,
23 bool hidden) {
24 if (factory_) {
25 return factory_->CreateRenderViewHost(instance, delegate, widget_delegate,
26 routing_id, main_frame_routing_id,
27 swapped_out);
29 return new RenderViewHostImpl(instance,
30 delegate,
31 widget_delegate,
32 routing_id,
33 main_frame_routing_id,
34 swapped_out,
35 hidden,
36 true /* has_initialized_audio_host */);
39 // static
40 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) {
41 DCHECK(!factory_) << "Can't register two factories at once.";
42 factory_ = factory;
45 // static
46 void RenderViewHostFactory::UnregisterFactory() {
47 DCHECK(factory_) << "No factory to unregister.";
48 factory_ = NULL;
51 } // namespace content