Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / loader / navigation_url_loader.cc
blob6ea915e32e06ce7ed7919471ffe38b737608abcd
1 // Copyright 2014 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/loader/navigation_url_loader.h"
7 #include "content/browser/frame_host/navigation_request_info.h"
8 #include "content/browser/loader/navigation_url_loader_factory.h"
9 #include "content/browser/loader/navigation_url_loader_impl.h"
11 namespace content {
13 static NavigationURLLoaderFactory* g_factory = nullptr;
15 scoped_ptr<NavigationURLLoader> NavigationURLLoader::Create(
16 BrowserContext* browser_context,
17 int frame_tree_node_id,
18 scoped_ptr<NavigationRequestInfo> request_info,
19 NavigationURLLoaderDelegate* delegate) {
20 if (g_factory) {
21 return g_factory->CreateLoader(browser_context, frame_tree_node_id,
22 request_info.Pass(), delegate);
24 return scoped_ptr<NavigationURLLoader>(new NavigationURLLoaderImpl(
25 browser_context, frame_tree_node_id, request_info.Pass(), delegate));
28 void NavigationURLLoader::SetFactoryForTesting(
29 NavigationURLLoaderFactory* factory) {
30 DCHECK(g_factory == nullptr || factory == nullptr);
31 g_factory = factory;
34 } // namespace content