blob: 8e9215c33a5d5427a37807df3b690d222660ea99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/frame_host/render_frame_host_factory.h"
#include "base/logging.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
namespace content {
// static
RenderFrameHostFactory* RenderFrameHostFactory::factory_ = NULL;
// static
scoped_ptr<RenderFrameHostImpl> RenderFrameHostFactory::Create(
RenderViewHostImpl* render_view_host,
FrameTree* frame_tree,
int routing_id,
bool is_swapped_out) {
if (factory_) {
return factory_->CreateRenderFrameHost(render_view_host,
frame_tree,
routing_id,
is_swapped_out).Pass();
}
return make_scoped_ptr(new RenderFrameHostImpl(
render_view_host, frame_tree, routing_id, is_swapped_out));
}
// static
void RenderFrameHostFactory::RegisterFactory(RenderFrameHostFactory* factory) {
DCHECK(!factory_) << "Can't register two factories at once.";
factory_ = factory;
}
// static
void RenderFrameHostFactory::UnregisterFactory() {
DCHECK(factory_) << "No factory to unregister.";
factory_ = NULL;
}
} // namespace content
|