Add remoting and PPAPI tests to GN build
[chromium-blink-merge.git] / content / browser / frame_host / render_frame_host_factory.cc
blob412073aa8bb14b396af4ea87cdfc2acf17edbb87
1 // Copyright 2013 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/frame_host/render_frame_host_factory.h"
7 #include "base/logging.h"
8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/frame_host/render_frame_host_impl.h"
11 namespace content {
13 // static
14 RenderFrameHostFactory* RenderFrameHostFactory::factory_ = NULL;
16 // static
17 scoped_ptr<RenderFrameHostImpl> RenderFrameHostFactory::Create(
18 SiteInstance* site_instance,
19 RenderViewHostImpl* render_view_host,
20 RenderFrameHostDelegate* delegate,
21 RenderWidgetHostDelegate* rwh_delegate,
22 FrameTree* frame_tree,
23 FrameTreeNode* frame_tree_node,
24 int routing_id,
25 int flags) {
26 if (factory_) {
27 return factory_->CreateRenderFrameHost(site_instance, render_view_host,
28 delegate, rwh_delegate, frame_tree,
29 frame_tree_node, routing_id, flags);
31 return make_scoped_ptr(new RenderFrameHostImpl(
32 site_instance, render_view_host, delegate, rwh_delegate, frame_tree,
33 frame_tree_node, routing_id, flags));
36 // static
37 void RenderFrameHostFactory::RegisterFactory(RenderFrameHostFactory* factory) {
38 DCHECK(!factory_) << "Can't register two factories at once.";
39 factory_ = factory;
42 // static
43 void RenderFrameHostFactory::UnregisterFactory() {
44 DCHECK(factory_) << "No factory to unregister.";
45 factory_ = NULL;
48 } // namespace content