Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / frame_host / render_frame_host_factory.cc
blob4262c1c7eb26741d8c261e67caf592176c2752f5
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 RenderViewHostImpl* render_view_host,
19 RenderFrameHostDelegate* delegate,
20 FrameTree* frame_tree,
21 FrameTreeNode* frame_tree_node,
22 int routing_id,
23 bool is_swapped_out) {
24 if (factory_) {
25 return factory_->CreateRenderFrameHost(render_view_host,
26 delegate,
27 frame_tree,
28 frame_tree_node,
29 routing_id,
30 is_swapped_out).Pass();
32 return make_scoped_ptr(new RenderFrameHostImpl(
33 render_view_host, delegate, frame_tree, frame_tree_node, routing_id,
34 is_swapped_out));
37 // static
38 void RenderFrameHostFactory::RegisterFactory(RenderFrameHostFactory* factory) {
39 DCHECK(!factory_) << "Can't register two factories at once.";
40 factory_ = factory;
43 // static
44 void RenderFrameHostFactory::UnregisterFactory() {
45 DCHECK(factory_) << "No factory to unregister.";
46 factory_ = NULL;
49 } // namespace content