[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / frame_host / render_frame_host_factory.cc
blob53edaebff2d1b696f949a6202060da3597111f03
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 int32 routing_id,
25 int32 widget_routing_id,
26 int32 surface_id,
27 int flags) {
28 if (factory_) {
29 return factory_->CreateRenderFrameHost(
30 site_instance, render_view_host, delegate, rwh_delegate, frame_tree,
31 frame_tree_node, routing_id, widget_routing_id, surface_id, flags);
33 return make_scoped_ptr(new RenderFrameHostImpl(
34 site_instance, render_view_host, delegate, rwh_delegate, frame_tree,
35 frame_tree_node, routing_id, widget_routing_id, surface_id, flags));
38 // static
39 void RenderFrameHostFactory::RegisterFactory(RenderFrameHostFactory* factory) {
40 DCHECK(!factory_) << "Can't register two factories at once.";
41 factory_ = factory;
44 // static
45 void RenderFrameHostFactory::UnregisterFactory() {
46 DCHECK(factory_) << "No factory to unregister.";
47 factory_ = NULL;
50 } // namespace content