| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/loader/navigation_url_loader.h" | 5 #include "content/browser/loader/navigation_url_loader.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "content/browser/frame_host/navigation_request_info.h" | 9 #include "content/browser/frame_host/navigation_request_info.h" |
| 8 #include "content/browser/loader/navigation_url_loader_factory.h" | 10 #include "content/browser/loader/navigation_url_loader_factory.h" |
| 9 #include "content/browser/loader/navigation_url_loader_impl.h" | 11 #include "content/browser/loader/navigation_url_loader_impl.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 static NavigationURLLoaderFactory* g_factory = nullptr; | 15 static NavigationURLLoaderFactory* g_factory = nullptr; |
| 14 | 16 |
| 15 scoped_ptr<NavigationURLLoader> NavigationURLLoader::Create( | 17 scoped_ptr<NavigationURLLoader> NavigationURLLoader::Create( |
| 16 BrowserContext* browser_context, | 18 BrowserContext* browser_context, |
| 17 scoped_ptr<NavigationRequestInfo> request_info, | 19 scoped_ptr<NavigationRequestInfo> request_info, |
| 18 ServiceWorkerNavigationHandle* service_worker_handle, | 20 ServiceWorkerNavigationHandle* service_worker_handle, |
| 19 NavigationURLLoaderDelegate* delegate) { | 21 NavigationURLLoaderDelegate* delegate) { |
| 20 if (g_factory) { | 22 if (g_factory) { |
| 21 return g_factory->CreateLoader(browser_context, request_info.Pass(), | 23 return g_factory->CreateLoader(browser_context, std::move(request_info), |
| 22 service_worker_handle, delegate); | 24 service_worker_handle, delegate); |
| 23 } | 25 } |
| 24 return scoped_ptr<NavigationURLLoader>(new NavigationURLLoaderImpl( | 26 return scoped_ptr<NavigationURLLoader>( |
| 25 browser_context, request_info.Pass(), service_worker_handle, delegate)); | 27 new NavigationURLLoaderImpl(browser_context, std::move(request_info), |
| 28 service_worker_handle, delegate)); |
| 26 } | 29 } |
| 27 | 30 |
| 28 void NavigationURLLoader::SetFactoryForTesting( | 31 void NavigationURLLoader::SetFactoryForTesting( |
| 29 NavigationURLLoaderFactory* factory) { | 32 NavigationURLLoaderFactory* factory) { |
| 30 DCHECK(g_factory == nullptr || factory == nullptr); | 33 DCHECK(g_factory == nullptr || factory == nullptr); |
| 31 g_factory = factory; | 34 g_factory = factory; |
| 32 } | 35 } |
| 33 | 36 |
| 34 } // namespace content | 37 } // namespace content |
| OLD | NEW |