0

Move SharedURLLoaderFactory to services/network/public/cpp/

We want to move |SharedURLLoaderFactory| to make it available to
consumers that doesn't depend on content/.

This CL is mostly mechanical changes and doesn't affect behaviors.

TBR=jam@chromium.org
(for fairly mechanical changes of callsites in chrome/).

Bug: 796425
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Icdaccce5323c7585e26f742e9d0433f0fa1aea4b
Reviewed-on: https://chromium-review.googlesource.com/959617
Reviewed-by: Chong Zhang <chongz@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Chong Zhang <chongz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542876}
This commit is contained in:
Chong Zhang
2018-03-13 19:14:11 +00:00
committed by Commit Bot
parent 4b12a32f86
commit b7c8d1ce9f
87 changed files with 332 additions and 272 deletions
chrome
content
browser
common
public
renderer
services/network/public/cpp

@ -14,8 +14,8 @@
#include "components/captive_portal/captive_portal_detector.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_member.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "net/base/backoff_entry.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "url/gurl.h"
class Profile;
@ -163,7 +163,7 @@ class CaptivePortalService : public KeyedService {
State state_;
scoped_refptr<content::SharedURLLoaderFactory> shared_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
// Detector for checking active network for a portal state.
std::unique_ptr<captive_portal::CaptivePortalDetector>

@ -8,7 +8,7 @@
#include <Cocoa/Cocoa.h>
#include "base/memory/ref_counted.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
class AccountAvatarFetcherBridge;
@class CredentialItemButton;
@ -17,12 +17,12 @@ class GURL;
// Handles retrieving avatar images for credential items.
@interface AccountAvatarFetcherManager : NSObject {
std::vector<std::unique_ptr<AccountAvatarFetcherBridge>> bridges_;
scoped_refptr<content::SharedURLLoaderFactory> loaderFactory_;
scoped_refptr<network::SharedURLLoaderFactory> loaderFactory_;
}
// Initializes a manager with the specified URL loader factory.
- (id)initWithLoaderFactory:
(scoped_refptr<content::SharedURLLoaderFactory>)loaderFactory;
(scoped_refptr<network::SharedURLLoaderFactory>)loaderFactory;
// Retrieves the image located at |avatarURL| and updates |view| if successful.
- (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemButton*)view;

@ -55,7 +55,7 @@ void AccountAvatarFetcherBridge::UpdateAvatar(const gfx::ImageSkia& image) {
@implementation AccountAvatarFetcherManager
- (id)initWithLoaderFactory:
(scoped_refptr<content::SharedURLLoaderFactory>)loaderFactory {
(scoped_refptr<network::SharedURLLoaderFactory>)loaderFactory {
if ((self = [super init])) {
loaderFactory_ = std::move(loaderFactory);
}

@ -82,7 +82,7 @@ class AccountChooserViewControllerTest : public CocoaTest,
// PasswordPromptBridgeInterface:
void PerformClose() override;
PasswordDialogController* GetDialogController() override;
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
const override;
private:
@ -122,7 +122,7 @@ AccountChooserViewControllerTest::GetDialogController() {
return &dialog_controller_;
}
scoped_refptr<content::SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
AccountChooserViewControllerTest::GetURLLoaderFactory() const {
NOTREACHED();
return nullptr;

@ -41,7 +41,7 @@ class AutoSigninPromptViewControllerTest : public PasswordPromptBridgeInterface,
// PasswordPromptBridgeInterface:
void PerformClose() override;
PasswordDialogController* GetDialogController() override;
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
const override;
private:
@ -71,7 +71,7 @@ AutoSigninPromptViewControllerTest::GetDialogController() {
return &dialog_controller_;
}
scoped_refptr<content::SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
AutoSigninPromptViewControllerTest::GetURLLoaderFactory() const {
NOTREACHED();
return nullptr;

@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
#define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
class PasswordDialogController;
@ -20,7 +20,7 @@ class PasswordPromptBridgeInterface {
virtual PasswordDialogController* GetDialogController() = 0;
// Returns the URL loader factory for fetching the avatars.
virtual scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
virtual scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
const = 0;
protected:

@ -36,7 +36,7 @@ class PasswordPromptViewBridge : public AccountChooserPrompt,
// PasswordPromptBridgeInterface:
void PerformClose() override;
PasswordDialogController* GetDialogController() override;
scoped_refptr<content::SharedURLLoaderFactory> GetURLLoaderFactory()
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory()
const override;
private:

@ -58,7 +58,7 @@ PasswordPromptViewBridge::GetDialogController() {
return controller_;
}
scoped_refptr<content::SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
PasswordPromptViewBridge::GetURLLoaderFactory() const {
return content::BrowserContext::GetDefaultStoragePartition(
Profile::FromBrowserContext(web_contents_->GetBrowserContext()))

@ -85,7 +85,7 @@ class DevToolsDataSource : public content::URLDataSource {
using GotDataCallback = content::URLDataSource::GotDataCallback;
explicit DevToolsDataSource(
scoped_refptr<content::SharedURLLoaderFactory> url_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: url_loader_factory_(std::move(url_loader_factory)) {}
// content::URLDataSource implementation.
@ -144,7 +144,7 @@ class DevToolsDataSource : public content::URLDataSource {
DISALLOW_COPY_AND_ASSIGN(PendingRequest);
};
scoped_refptr<content::SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
std::list<PendingRequest> pending_requests_;
DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource);

@ -39,6 +39,7 @@
#include "ipc/ipc_message_macros.h"
#include "net/base/net_errors.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"

@ -12,7 +12,6 @@
#include "content/browser/appcache/appcache_url_loader_request.h"
#include "content/browser/url_loader_factory_getter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
@ -20,6 +19,7 @@
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {

@ -216,7 +216,7 @@ DownloadManagerImpl::UniqueUrlDownloadHandlerPtr BeginResourceDownload(
return nullptr;
}
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory;
if (params->url().SchemeIs(url::kBlobScheme)) {
network::mojom::URLLoaderFactoryPtrInfo url_loader_factory_ptr_info;
storage::BlobURLLoaderFactory::Create(

@ -11,8 +11,8 @@
#include "content/browser/download/resource_downloader.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
namespace {

@ -12,7 +12,7 @@
#include "content/browser/download/download_utils.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace network {
struct ResourceResponseHead;
@ -65,7 +65,7 @@ std::unique_ptr<ResourceDownloader> ResourceDownloader::BeginDownload(
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
std::unique_ptr<download::DownloadUrlParameters> params,
std::unique_ptr<network::ResourceRequest> request,
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
const GURL& site_url,
const GURL& tab_url,
const GURL& tab_referrer_url,
@ -124,7 +124,7 @@ ResourceDownloader::ResourceDownloader(
ResourceDownloader::~ResourceDownloader() = default;
void ResourceDownloader::Start(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
bool is_parallel_request) {
callback_ = download_url_parameters->callback();

@ -12,9 +12,11 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
namespace content {
namespace network {
class SharedURLLoaderFactory;
}
namespace content {
// Class for handing the download of a url.
class ResourceDownloader : public UrlDownloadHandler,
@ -25,7 +27,7 @@ class ResourceDownloader : public UrlDownloadHandler,
base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
std::unique_ptr<network::ResourceRequest> request,
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
const GURL& site_url,
const GURL& tab_url,
const GURL& tab_referrer_url,
@ -65,7 +67,7 @@ class ResourceDownloader : public UrlDownloadHandler,
private:
// Helper method to start the network request.
void Start(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::unique_ptr<download::DownloadUrlParameters> download_url_parameters,
bool is_parallel_request);

@ -578,7 +578,7 @@ class NavigationURLLoaderNetworkService::URLLoaderRequestController
// TODO(https://crbug.com/796425): We temporarily wrap raw
// mojom::URLLoaderFactory pointers into SharedURLLoaderFactory. Need to
// further refactor the factory getters to avoid this.
scoped_refptr<SharedURLLoaderFactory> factory;
scoped_refptr<network::SharedURLLoaderFactory> factory;
DCHECK_EQ(handlers_.size(), handler_index_);
if (resource_request_->url.SchemeIs(url::kBlobScheme)) {
factory = base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(

@ -7,9 +7,9 @@
#include "base/feature_list.h"
#include "content/browser/web_package/web_package_prefetch_handler.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
@ -20,7 +20,7 @@ PrefetchURLLoader::PrefetchURLLoader(
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
ResourceContext* resource_context,
scoped_refptr<net::URLRequestContextGetter> request_context_getter)

@ -19,10 +19,13 @@ namespace net {
class URLRequestContextGetter;
}
namespace network {
class SharedURLLoaderFactory;
}
namespace content {
class ResourceContext;
class SharedURLLoaderFactory;
class URLLoaderThrottle;
class WebPackagePrefetchHandler;
@ -46,7 +49,7 @@ class CONTENT_EXPORT PrefetchURLLoader
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
ResourceContext* resource_context,
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
@ -85,7 +88,7 @@ class CONTENT_EXPORT PrefetchURLLoader
void OnNetworkConnectionError();
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
// For the actual request.
network::mojom::URLLoaderPtr loader_;

@ -12,11 +12,11 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/common/url_loader_throttle.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
@ -55,7 +55,7 @@ void PrefetchURLLoaderService::CreateLoaderAndStart(
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
int frame_tree_node_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK_EQ(RESOURCE_TYPE_PREFETCH, resource_request.resource_type);

@ -18,10 +18,13 @@ namespace net {
class URLRequestContextGetter;
}
namespace network {
class SharedURLLoaderFactory;
}
namespace content {
class ResourceContext;
class SharedURLLoaderFactory;
class URLLoaderFactoryGetter;
class URLLoaderThrottle;
@ -59,7 +62,7 @@ class CONTENT_EXPORT PrefetchURLLoaderService final
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
int frame_tree_node_id = -1);
// Register a callback that is fired right before a prefetch load is started

@ -30,7 +30,7 @@ namespace content {
namespace {
using SharedURLLoaderFactoryGetterCallback =
base::OnceCallback<scoped_refptr<SharedURLLoaderFactory>()>;
base::OnceCallback<scoped_refptr<network::SharedURLLoaderFactory>()>;
network::mojom::NetworkContextPtr CreateNetworkContext() {
network::mojom::NetworkContextPtr network_context;
@ -91,15 +91,16 @@ int LoadBasicRequestOnUIThread(
return simple_loader->NetError();
}
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
SharedURLLoaderFactoryGetterCallback shared_url_loader_factory_getter) {
scoped_refptr<SharedURLLoaderFactory> shared_factory;
scoped_refptr<network::SharedURLLoaderFactory> shared_factory;
base::RunLoop run_loop;
BrowserThread::PostTaskAndReply(
BrowserThread::IO, FROM_HERE,
base::BindOnce(
[](SharedURLLoaderFactoryGetterCallback getter,
scoped_refptr<SharedURLLoaderFactory>* shared_factory_ptr) {
scoped_refptr<network::SharedURLLoaderFactory>*
shared_factory_ptr) {
*shared_factory_ptr = std::move(getter).Run();
},
std::move(shared_url_loader_factory_getter),
@ -109,24 +110,25 @@ scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
return shared_factory;
}
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
URLLoaderFactoryGetter* url_loader_factory_getter) {
return GetSharedFactoryOnIOThread(
base::BindOnce(&URLLoaderFactoryGetter::GetNetworkFactory,
base::Unretained(url_loader_factory_getter)));
}
scoped_refptr<SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
std::unique_ptr<SharedURLLoaderFactoryInfo> info) {
return GetSharedFactoryOnIOThread(
base::BindOnce(&SharedURLLoaderFactory::Create, std::move(info)));
scoped_refptr<network::SharedURLLoaderFactory> GetSharedFactoryOnIOThread(
std::unique_ptr<network::SharedURLLoaderFactoryInfo> info) {
return GetSharedFactoryOnIOThread(base::BindOnce(
&network::SharedURLLoaderFactory::Create, std::move(info)));
}
void ReleaseOnIOThread(scoped_refptr<SharedURLLoaderFactory> shared_factory) {
void ReleaseOnIOThread(
scoped_refptr<network::SharedURLLoaderFactory> shared_factory) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(
[](scoped_refptr<SharedURLLoaderFactory> factory) {
[](scoped_refptr<network::SharedURLLoaderFactory> factory) {
factory = nullptr;
},
std::move(shared_factory)));
@ -343,7 +345,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter =
partition->url_loader_factory_getter();
scoped_refptr<SharedURLLoaderFactory> shared_factory =
scoped_refptr<network::SharedURLLoaderFactory> shared_factory =
GetSharedFactoryOnIOThread(url_loader_factory_getter.get());
EXPECT_EQ(net::OK,
LoadBasicRequestOnIOThread(shared_factory.get(), GetTestURL()));
@ -372,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
BrowserContext::GetDefaultStoragePartition(browser_context()));
scoped_refptr<SharedURLLoaderFactory> shared_factory =
scoped_refptr<network::SharedURLLoaderFactory> shared_factory =
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get());
EXPECT_EQ(net::OK,
@ -402,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
std::make_unique<ShellBrowserContext>(true, nullptr);
auto* partition = static_cast<StoragePartitionImpl*>(
BrowserContext::GetDefaultStoragePartition(browser_context.get()));
scoped_refptr<content::SharedURLLoaderFactory> shared_factory(
scoped_refptr<network::SharedURLLoaderFactory> shared_factory(
GetSharedFactoryOnIOThread(partition->url_loader_factory_getter().get()));
EXPECT_EQ(net::OK,
@ -486,7 +488,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
std::make_unique<ShellBrowserContext>(true, nullptr);
auto* partition =
BrowserContext::GetDefaultStoragePartition(browser_context.get());
scoped_refptr<content::SharedURLLoaderFactory> factory(
scoped_refptr<network::SharedURLLoaderFactory> factory(
partition->GetURLLoaderFactoryForBrowserProcess());
EXPECT_EQ(net::OK, LoadBasicRequestOnUIThread(factory.get(), GetTestURL()));
@ -503,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest, BrowserIOFactory) {
auto* partition =
BrowserContext::GetDefaultStoragePartition(browser_context());
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
GetSharedFactoryOnIOThread(
partition->GetURLLoaderFactoryForBrowserProcessIOThread());
@ -537,7 +539,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
browser_context.reset();
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
GetSharedFactoryOnIOThread(std::move(shared_url_loader_factory_info));
EXPECT_EQ(net::ERR_FAILED,
@ -556,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(NetworkServiceRestartBrowserTest,
std::make_unique<ShellBrowserContext>(true, nullptr);
auto* partition =
BrowserContext::GetDefaultStoragePartition(browser_context.get());
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory =
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory =
GetSharedFactoryOnIOThread(
partition->GetURLLoaderFactoryForBrowserProcessIOThread());

@ -291,7 +291,7 @@ class StoragePartitionImpl::NetworkContextOwner {
};
class StoragePartitionImpl::URLLoaderFactoryForBrowserProcess
: public SharedURLLoaderFactory {
: public network::SharedURLLoaderFactory {
public:
explicit URLLoaderFactoryForBrowserProcess(
StoragePartitionImpl* storage_partition)
@ -316,7 +316,7 @@ class StoragePartitionImpl::URLLoaderFactoryForBrowserProcess
}
// SharedURLLoaderFactory implementation:
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
" on the IO thread, get it from URLLoaderFactoryGetter.";
return nullptr;
@ -729,7 +729,7 @@ network::mojom::NetworkContext* StoragePartitionImpl::GetNetworkContext() {
return network_context_.get();
}
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
if (!shared_url_loader_factory_for_browser_process_) {
shared_url_loader_factory_for_browser_process_ =
@ -738,7 +738,7 @@ StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
return shared_url_loader_factory_for_browser_process_;
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcessIOThread() {
return url_loader_factory_getter_->GetNetworkFactoryInfo();
}

@ -91,9 +91,9 @@ class CONTENT_EXPORT StoragePartitionImpl
net::URLRequestContextGetter* GetURLRequestContext() override;
net::URLRequestContextGetter* GetMediaURLRequestContext() override;
network::mojom::NetworkContext* GetNetworkContext() override;
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactoryForBrowserProcess()
override;
std::unique_ptr<SharedURLLoaderFactoryInfo>
scoped_refptr<network::SharedURLLoaderFactory>
GetURLLoaderFactoryForBrowserProcess() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
GetURLLoaderFactoryForBrowserProcessIOThread() override;
network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override;
storage::QuotaManager* GetQuotaManager() override;

@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "content/browser/storage_partition_impl.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/network_service.mojom.h"
namespace content {
@ -18,7 +18,7 @@ base::LazyInstance<URLLoaderFactoryGetter::GetNetworkFactoryCallback>::Leaky
}
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
: public SharedURLLoaderFactoryInfo {
: public network::SharedURLLoaderFactoryInfo {
public:
URLLoaderFactoryForIOThreadInfo() = default;
explicit URLLoaderFactoryForIOThreadInfo(
@ -32,7 +32,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
protected:
// SharedURLLoaderFactoryInfo implementation.
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
@ -40,7 +40,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo
};
class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
: public SharedURLLoaderFactory {
: public network::SharedURLLoaderFactory {
public:
explicit URLLoaderFactoryForIOThread(
scoped_refptr<URLLoaderFactoryGetter> factory_getter)
@ -72,7 +72,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
}
// SharedURLLoaderFactory implementation:
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
NOTREACHED() << "This isn't supported. If you need a SharedURLLoaderFactory"
" on the UI thread, get it from StoragePartition.";
return nullptr;
@ -87,7 +87,7 @@ class URLLoaderFactoryGetter::URLLoaderFactoryForIOThread
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryForIOThread);
};
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
URLLoaderFactoryGetter::URLLoaderFactoryForIOThreadInfo::CreateFactory() {
auto other = std::make_unique<URLLoaderFactoryForIOThreadInfo>();
other->factory_getter_ = std::move(factory_getter_);
@ -122,14 +122,14 @@ void URLLoaderFactoryGetter::OnStoragePartitionDestroyed() {
partition_ = nullptr;
}
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
URLLoaderFactoryGetter::GetNetworkFactory() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
return base::MakeRefCounted<URLLoaderFactoryForIOThread>(
base::WrapRefCounted(this));
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
URLLoaderFactoryGetter::GetNetworkFactoryInfo() {
return std::make_unique<URLLoaderFactoryForIOThreadInfo>(
base::WrapRefCounted(this));

@ -12,10 +12,13 @@
#include "content/public/browser/browser_thread.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
namespace network {
class SharedURLLoaderFactoryInfo;
class SharedURLLoaderFactory;
} // namespace network
namespace content {
class StoragePartitionImpl;
// Holds on to URLLoaderFactory for a given StoragePartition and allows code
@ -39,12 +42,13 @@ class URLLoaderFactoryGetter
// Called on the IO thread to get a shared wrapper to this
// URLLoaderFactoryGetter, which can be used to access the URLLoaderFactory
// to the network service and supports auto-reconnect after crash.
CONTENT_EXPORT scoped_refptr<SharedURLLoaderFactory> GetNetworkFactory();
CONTENT_EXPORT scoped_refptr<network::SharedURLLoaderFactory>
GetNetworkFactory();
// Called on the UI thread to get an info that holds a reference to this
// URLLoaderFactoryGetter, which can be used to construct a similar
// SharedURLLoaderFactory as returned from |GetNetworkFactory()| on IO thread.
CONTENT_EXPORT std::unique_ptr<SharedURLLoaderFactoryInfo>
CONTENT_EXPORT std::unique_ptr<network::SharedURLLoaderFactoryInfo>
GetNetworkFactoryInfo();
// Called on the IO thread. Will clone the internal factory to the network

@ -52,7 +52,7 @@ std::unique_ptr<SignedExchangeHandler> MockSignedExchangeHandlerFactory::Create(
std::unique_ptr<net::SourceStream> body,
ExchangeHeadersCallback headers_callback,
url::Origin request_initiator,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter) {
return std::make_unique<MockSignedExchangeHandler>(
error_, request_url_, mime_type_, response_headers_, std::move(body),

@ -50,7 +50,7 @@ class MockSignedExchangeHandlerFactory final
std::unique_ptr<net::SourceStream> body,
ExchangeHeadersCallback headers_callback,
url::Origin request_initiator,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter) override;
private:

@ -8,12 +8,12 @@
#include "base/strings/string_piece.h"
#include "content/common/throttling_url_loader.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/common/url_loader_throttle.h"
#include "ipc/ipc_message.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
@ -85,7 +85,7 @@ bool Consume3Bytes(base::StringPiece* data, uint32_t* out) {
// static
std::unique_ptr<SignedExchangeCertFetcher>
SignedExchangeCertFetcher::CreateAndStart(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
const GURL& cert_url,
url::Origin request_initiator,
@ -155,7 +155,7 @@ SignedExchangeCertFetcher::GetCertChainFromMessage(base::StringPiece message) {
}
SignedExchangeCertFetcher::SignedExchangeCertFetcher(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
const GURL& cert_url,
url::Origin request_initiator,

@ -21,13 +21,16 @@ namespace net {
class X509Certificate;
} // namespace net
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace mojo {
class SimpleWatcher;
} // namespace mojo
namespace content {
class SharedURLLoaderFactory;
class ThrottlingURLLoader;
class URLLoaderThrottle;
@ -43,7 +46,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
// with null. If the returned fetcher is destructed before the |callback| is
// called, the request will be canceled and the |callback| will no be called.
static std::unique_ptr<SignedExchangeCertFetcher> CreateAndStart(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
const GURL& cert_url,
url::Origin request_initiator,
@ -68,7 +71,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
static base::ScopedClosureRunner SetMaxCertSizeForTest(size_t max_cert_size);
SignedExchangeCertFetcher(
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
const GURL& cert_url,
url::Origin request_initiator,
@ -96,7 +99,7 @@ class CONTENT_EXPORT SignedExchangeCertFetcher
mojo::ScopedDataPipeConsumerHandle body) override;
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles_;
std::unique_ptr<network::ResourceRequest> resource_request_;
CertificateCallback callback_;

@ -11,7 +11,6 @@
#include "content/browser/web_package/signed_exchange_header.h"
#include "content/browser/web_package/signed_exchange_signature_verifier.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/common/url_loader_throttle.h"
#include "mojo/public/cpp/system/string_data_pipe_producer.h"
#include "net/base/io_buffer.h"
@ -25,6 +24,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
namespace content {
@ -51,7 +51,7 @@ SignedExchangeHandler::SignedExchangeHandler(
std::unique_ptr<net::SourceStream> body,
ExchangeHeadersCallback headers_callback,
url::Origin request_initiator,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
: headers_callback_(std::move(headers_callback)),

@ -11,13 +11,13 @@
#include "base/optional.h"
#include "content/browser/web_package/signed_exchange_header.h"
#include "content/common/content_export.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/completion_callback.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/cert_verify_result.h"
#include "net/log/net_log_with_source.h"
#include "net/ssl/ssl_info.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "url/gurl.h"
#include "url/origin.h"
@ -31,12 +31,12 @@ class X509Certificate;
} // namespace net
namespace network {
class SharedURLLoaderFactory;
struct ResourceResponseHead;
}
} // namespace network
namespace content {
class SharedURLLoaderFactory;
class SignedExchangeCertFetcher;
class URLLoaderThrottle;
@ -70,7 +70,7 @@ class CONTENT_EXPORT SignedExchangeHandler {
std::unique_ptr<net::SourceStream> body,
ExchangeHeadersCallback headers_callback,
url::Origin request_initiator,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
~SignedExchangeHandler();
@ -111,7 +111,7 @@ class CONTENT_EXPORT SignedExchangeHandler {
// Used to create |cert_fetcher_|.
url::Origin request_initiator_;
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
// This getter is guaranteed to be valid at least until the headers callback
// is run.
URLLoaderThrottlesGetter url_loader_throttles_getter_;
@ -145,7 +145,7 @@ class SignedExchangeHandlerFactory {
std::unique_ptr<net::SourceStream> body,
SignedExchangeHandler::ExchangeHeadersCallback headers_callback,
url::Origin request_initiator,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
SignedExchangeHandler::URLLoaderThrottlesGetter
url_loader_throttles_getter) = 0;
};

@ -50,7 +50,7 @@ void SignedExchangeURLLoaderFactoryForNonNetworkService::CreateLoaderAndStart(
std::move(client), traffic_annotation);
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
SignedExchangeURLLoaderFactoryForNonNetworkService::Clone() {
NOTREACHED();
return nullptr;

@ -6,7 +6,7 @@
#define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_URL_LOADER_FACTORY_FOR_NON_NETWORK_SERVICE_H_
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace net {
class URLRequestContextGetter;
@ -19,7 +19,7 @@ class ResourceContext;
// A URLLoaderFactory used for fetching certificate of signed HTTP exchange
// when NetworkService is not enabled.
class SignedExchangeURLLoaderFactoryForNonNetworkService
: public SharedURLLoaderFactory {
: public network::SharedURLLoaderFactory {
public:
SignedExchangeURLLoaderFactoryForNonNetworkService(
ResourceContext* resource_context,
@ -34,7 +34,7 @@ class SignedExchangeURLLoaderFactoryForNonNetworkService
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
private:
~SignedExchangeURLLoaderFactoryForNonNetworkService() override;

@ -12,11 +12,11 @@
#include "content/browser/loader/source_stream_to_data_pipe.h"
#include "content/browser/web_package/signed_exchange_handler.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "net/cert/cert_status_flags.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
@ -79,7 +79,7 @@ WebPackageLoader::WebPackageLoader(
network::mojom::URLLoaderClientEndpointsPtr endpoints,
url::Origin request_initiator,
uint32_t url_loader_options,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
: original_response_timing_info_(

@ -20,9 +20,12 @@ class SourceStream;
class URLRequestContextGetter;
} // namespace net
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace content {
class SharedURLLoaderFactory;
class SignedExchangeHandler;
class SignedExchangeHandlerFactory;
class URLLoaderThrottle;
@ -45,7 +48,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
network::mojom::URLLoaderClientEndpointsPtr endpoints,
url::Origin request_initiator,
uint32_t url_loader_options,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
~WebPackageLoader() override;
@ -124,7 +127,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
url::Origin request_initiator_;
const uint32_t url_loader_options_;
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
URLLoaderThrottlesGetter url_loader_throttles_getter_;
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;

@ -32,7 +32,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler(
const network::ResourceResponseHead& response,
network::mojom::URLLoaderPtr network_loader,
network::mojom::URLLoaderClientRequest network_client_request,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
url::Origin request_initiator,
URLLoaderThrottlesGetter loader_throttles_getter,
ResourceContext* resource_context,
@ -45,7 +45,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler(
std::move(network_client_request));
network::mojom::URLLoaderClientPtr client;
loader_client_binding_.Bind(mojo::MakeRequest(&client));
scoped_refptr<SharedURLLoaderFactory> url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
url_loader_factory = base::MakeRefCounted<
SignedExchangeURLLoaderFactoryForNonNetworkService>(

@ -13,11 +13,14 @@ namespace net {
class URLRequestContextGetter;
}
namespace network {
class SharedURLLoaderFactory;
}
namespace content {
class ResourceContext;
class URLLoaderThrottle;
class SharedURLLoaderFactory;
class WebPackageLoader;
// Attached to each PrefetchURLLoader if the prefetch is for a signed exchange.
@ -37,7 +40,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
const network::ResourceResponseHead& response,
network::mojom::URLLoaderPtr network_loader,
network::mojom::URLLoaderClientRequest network_client_request,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory,
url::Origin request_initiator,
URLLoaderThrottlesGetter loader_throttles_getter,
ResourceContext* resource_context,

@ -11,11 +11,11 @@
#include "content/browser/web_package/web_package_loader.h"
#include "content/common/throttling_url_loader.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader.mojom.h"
namespace content {
@ -30,7 +30,7 @@ bool WebPackageRequestHandler::IsSupportedMimeType(
WebPackageRequestHandler::WebPackageRequestHandler(
url::Origin request_initiator,
uint32_t url_loader_options,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter)
: request_initiator_(std::move(request_initiator)),

@ -14,9 +14,12 @@ namespace net {
class URLRequestContextGetter;
} // namespace net
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace content {
class SharedURLLoaderFactory;
class URLLoaderThrottle;
class WebPackageLoader;
@ -30,7 +33,7 @@ class WebPackageRequestHandler final : public URLLoaderRequestHandler {
WebPackageRequestHandler(
url::Origin request_initiator,
uint32_t url_loader_options,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
~WebPackageRequestHandler() override;
@ -56,7 +59,7 @@ class WebPackageRequestHandler final : public URLLoaderRequestHandler {
url::Origin request_initiator_;
const uint32_t url_loader_options_;
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
URLLoaderThrottlesGetter url_loader_throttles_getter_;
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;

@ -57,14 +57,14 @@ class SingleRequestURLLoaderFactory::HandlerState
};
class SingleRequestURLLoaderFactory::FactoryInfo
: public SharedURLLoaderFactoryInfo {
: public network::SharedURLLoaderFactoryInfo {
public:
explicit FactoryInfo(scoped_refptr<HandlerState> state)
: state_(std::move(state)) {}
~FactoryInfo() override = default;
// SharedURLLoaderFactoryInfo:
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override {
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override {
return new SingleRequestURLLoaderFactory(std::move(state_));
}
@ -89,7 +89,7 @@ void SingleRequestURLLoaderFactory::CreateLoaderAndStart(
state_->HandleRequest(std::move(loader), std::move(client));
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
SingleRequestURLLoaderFactory::Clone() {
return std::make_unique<FactoryInfo>(state_);
}

@ -5,7 +5,7 @@
#ifndef CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
#define CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "base/memory/ref_counted.h"
#include "services/network/public/mojom/url_loader.mojom.h"
@ -15,7 +15,7 @@ namespace content {
// An implementation of SharedURLLoaderFactory which handles only a single
// request. It's an error to call CreateLoaderAndStart() more than a total of
// one time across this object or any of its clones.
class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory {
class SingleRequestURLLoaderFactory : public network::SharedURLLoaderFactory {
public:
using RequestHandler =
base::OnceCallback<void(network::mojom::URLLoaderRequest,
@ -32,7 +32,7 @@ class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory {
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
private:
class FactoryInfo;

@ -109,7 +109,7 @@ class ThrottlingURLLoader::ForwardingThrottleDelegate
};
ThrottlingURLLoader::StartInfo::StartInfo(
scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory,
int32_t in_routing_id,
int32_t in_request_id,
uint32_t in_options,
@ -150,7 +150,7 @@ ThrottlingURLLoader::PriorityInfo::~PriorityInfo() = default;
// static
std::unique_ptr<ThrottlingURLLoader> ThrottlingURLLoader::CreateLoaderAndStart(
scoped_refptr<SharedURLLoaderFactory> factory,
scoped_refptr<network::SharedURLLoaderFactory> factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
int32_t routing_id,
int32_t request_id,
@ -219,7 +219,7 @@ ThrottlingURLLoader::ThrottlingURLLoader(
}
void ThrottlingURLLoader::Start(
scoped_refptr<SharedURLLoaderFactory> factory,
scoped_refptr<network::SharedURLLoaderFactory> factory,
int32_t routing_id,
int32_t request_id,
uint32_t options,
@ -256,7 +256,7 @@ void ThrottlingURLLoader::Start(
}
void ThrottlingURLLoader::StartNow(
SharedURLLoaderFactory* factory,
network::SharedURLLoaderFactory* factory,
int32_t routing_id,
int32_t request_id,
uint32_t options,

@ -14,9 +14,9 @@
#include "base/threading/thread_task_runner_handle.h"
#include "content/common/content_export.h"
#include "content/common/possibly_associated_interface_ptr.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/common/url_loader_throttle.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
@ -38,7 +38,7 @@ class CONTENT_EXPORT ThrottlingURLLoader
// note that the request may not start immediately since it could be deferred
// by throttles.
static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart(
scoped_refptr<SharedURLLoaderFactory> factory,
scoped_refptr<network::SharedURLLoaderFactory> factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
int32_t routing_id,
int32_t request_id,
@ -72,14 +72,14 @@ class CONTENT_EXPORT ThrottlingURLLoader
network::mojom::URLLoaderClient* client,
const net::NetworkTrafficAnnotationTag& traffic_annotation);
void Start(scoped_refptr<SharedURLLoaderFactory> factory,
void Start(scoped_refptr<network::SharedURLLoaderFactory> factory,
int32_t routing_id,
int32_t request_id,
uint32_t options,
network::ResourceRequest* url_request,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void StartNow(SharedURLLoaderFactory* factory,
void StartNow(network::SharedURLLoaderFactory* factory,
int32_t routing_id,
int32_t request_id,
uint32_t options,
@ -171,15 +171,16 @@ class CONTENT_EXPORT ThrottlingURLLoader
network::mojom::URLLoaderPtr url_loader_;
struct StartInfo {
StartInfo(scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory,
int32_t in_routing_id,
int32_t in_request_id,
uint32_t in_options,
network::ResourceRequest* in_url_request,
scoped_refptr<base::SingleThreadTaskRunner> in_task_runner);
StartInfo(
scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory,
int32_t in_routing_id,
int32_t in_request_id,
uint32_t in_options,
network::ResourceRequest* in_url_request,
scoped_refptr<base::SingleThreadTaskRunner> in_task_runner);
~StartInfo();
scoped_refptr<SharedURLLoaderFactory> url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
int32_t routing_id;
int32_t request_id;
uint32_t options;

@ -37,7 +37,7 @@ class TestURLLoaderFactory : public network::mojom::URLLoaderFactory,
mojo::Binding<network::mojom::URLLoader>& url_loader_binding() {
return url_loader_binding_;
}
scoped_refptr<SharedURLLoaderFactory> shared_factory() {
scoped_refptr<network::SharedURLLoaderFactory> shared_factory() {
return shared_factory_;
}

@ -20,7 +20,7 @@ URLLoaderFactoryBundleInfo::URLLoaderFactoryBundleInfo(
URLLoaderFactoryBundleInfo::~URLLoaderFactoryBundleInfo() = default;
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
URLLoaderFactoryBundleInfo::CreateFactory() {
auto other = std::make_unique<URLLoaderFactoryBundleInfo>();
other->default_factory_info_ = std::move(default_factory_info_);
@ -78,7 +78,8 @@ void URLLoaderFactoryBundle::CreateLoaderAndStart(
traffic_annotation);
}
std::unique_ptr<SharedURLLoaderFactoryInfo> URLLoaderFactoryBundle::Clone() {
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
URLLoaderFactoryBundle::Clone() {
network::mojom::URLLoaderFactoryPtrInfo default_factory_info;
if (default_factory_)
default_factory_->Clone(mojo::MakeRequest(&default_factory_info));

@ -10,7 +10,7 @@
#include "base/macros.h"
#include "content/common/content_export.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
class GURL;
@ -20,7 +20,7 @@ namespace content {
// Holds the internal state of a URLLoaderFactoryBundle in a form that is safe
// to pass across sequences.
class CONTENT_EXPORT URLLoaderFactoryBundleInfo
: public SharedURLLoaderFactoryInfo {
: public network::SharedURLLoaderFactoryInfo {
public:
URLLoaderFactoryBundleInfo();
URLLoaderFactoryBundleInfo(
@ -40,7 +40,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo
protected:
// SharedURLLoaderFactoryInfo implementation.
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
network::mojom::URLLoaderFactoryPtrInfo default_factory_info_;
std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>
@ -51,7 +51,8 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo
// Encapsulates a collection of URLLoaderFactoryPtrs which can be usd to acquire
// loaders for various types of resource requests.
class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory {
class CONTENT_EXPORT URLLoaderFactoryBundle
: public network::SharedURLLoaderFactory {
public:
URLLoaderFactoryBundle();
@ -81,7 +82,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory {
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
// The |info| contains replacement factories for a subset of the existing
// bundle.

@ -32,7 +32,7 @@ void WeakWrapperSharedURLLoaderFactory::CreateLoaderAndStart(
traffic_annotation);
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
WeakWrapperSharedURLLoaderFactory::Clone() {
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
if (factory_ptr_)

@ -6,7 +6,7 @@
#define CONTENT_COMMON_WEAK_WRAPPER_SHARED_URL_LOADER_FACTORY_H_
#include "content/common/content_export.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
@ -14,7 +14,7 @@ namespace content {
// A SharedURLLoaderFactory implementation that wraps a raw
// mojom::URLLoaderFactory pointer.
class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory
: public SharedURLLoaderFactory {
: public network::SharedURLLoaderFactory {
public:
explicit WeakWrapperSharedURLLoaderFactory(
network::mojom::URLLoaderFactory* factory_ptr);
@ -33,7 +33,7 @@ class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
private:
~WeakWrapperSharedURLLoaderFactory() override;

@ -17,7 +17,7 @@ WrapperSharedURLLoaderFactoryInfo::WrapperSharedURLLoaderFactoryInfo(
WrapperSharedURLLoaderFactoryInfo::~WrapperSharedURLLoaderFactoryInfo() =
default;
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
WrapperSharedURLLoaderFactoryInfo::CreateFactory() {
return base::MakeRefCounted<WrapperSharedURLLoaderFactory>(
std::move(factory_ptr_info_));

@ -7,8 +7,8 @@
#include "content/common/content_export.h"
#include "content/common/possibly_associated_interface_ptr.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
@ -16,7 +16,7 @@ namespace content {
// A SharedURLLoaderFactoryInfo implementation that wraps a
// network::mojom::URLLoaderFactoryPtrInfo.
class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
: public SharedURLLoaderFactoryInfo {
: public network::SharedURLLoaderFactoryInfo {
public:
WrapperSharedURLLoaderFactoryInfo();
explicit WrapperSharedURLLoaderFactoryInfo(
@ -26,7 +26,7 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
private:
// SharedURLLoaderFactoryInfo implementation.
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info_;
};
@ -34,7 +34,8 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo
// A SharedURLLoaderFactory implementation that wraps a
// PtrTemplateType<network::mojom::URLLoaderFactory>.
template <template <typename> class PtrTemplateType>
class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory {
class WrapperSharedURLLoaderFactoryBase
: public network::SharedURLLoaderFactory {
public:
using PtrType = PtrTemplateType<network::mojom::URLLoaderFactory>;
using PtrInfoType = typename PtrType::PtrInfoType;
@ -61,7 +62,7 @@ class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory {
std::move(client), traffic_annotation);
}
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override {
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override {
network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
if (factory_ptr_)
factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info));

@ -13,8 +13,8 @@
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "net/cookies/cookie_store.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
class GURL;
@ -84,9 +84,9 @@ class CONTENT_EXPORT StoragePartition {
// use after StoragePartition has gone.
// The returned SharedURLLoaderFactory can be held on and will work across
// network process restarts.
virtual scoped_refptr<SharedURLLoaderFactory>
virtual scoped_refptr<network::SharedURLLoaderFactory>
GetURLLoaderFactoryForBrowserProcess() = 0;
virtual std::unique_ptr<SharedURLLoaderFactoryInfo>
virtual std::unique_ptr<network::SharedURLLoaderFactoryInfo>
GetURLLoaderFactoryForBrowserProcessIOThread() = 0;
virtual network::mojom::CookieManager*
GetCookieManagerForBrowserProcess() = 0;

@ -215,8 +215,6 @@ jumbo_source_set("common_sources") {
"screen_orientation_values.h",
"send_zygote_child_ping_linux.h",
"service_manager_connection.h",
"shared_url_loader_factory.cc",
"shared_url_loader_factory.h",
"simple_connection_filter.cc",
"simple_connection_filter.h",
"socket_permission_request.h",

@ -40,6 +40,10 @@ class Range;
class Size;
}
namespace network {
class SharedURLLoaderFactory;
}
namespace service_manager {
class InterfaceProvider;
}
@ -54,7 +58,6 @@ class PluginInstanceThrottler;
class RenderAccessibility;
class RenderFrameVisitor;
class RenderView;
class SharedURLLoaderFactory;
struct ContextMenuParams;
struct WebPluginInfo;
struct WebPreferences;
@ -262,7 +265,8 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener,
// Set the accessibility mode to force creation of RenderAccessibility.
virtual void SetAccessibilityModeForTest(ui::AXMode new_mode) = 0;
virtual scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactory() = 0;
virtual scoped_refptr<network::SharedURLLoaderFactory>
GetURLLoaderFactory() = 0;
protected:
~RenderFrame() override {}

@ -10,7 +10,6 @@
#include "base/callback.h"
#include "content/common/content_export.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
class GURL;
@ -28,6 +27,10 @@ namespace net {
struct NetworkTrafficAnnotationTag;
}
namespace network {
class SharedURLLoaderFactory;
}
namespace content {
// Interface to download resources asynchronously. Specified callback will be
@ -62,7 +65,7 @@ class CONTENT_EXPORT ResourceFetcher {
virtual void Start(
blink::WebLocalFrame* frame,
blink::WebURLRequest::RequestContext request_context,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const net::NetworkTrafficAnnotationTag& annotation_tag,
Callback callback,
size_t maximum_download_size = kDefaultMaximumDownloadSize) = 0;

@ -26,12 +26,12 @@ network::mojom::NetworkContext* TestStoragePartition::GetNetworkContext() {
return network_context_;
}
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() {
return nullptr;
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
TestStoragePartition::GetURLLoaderFactoryForBrowserProcessIOThread() {
return nullptr;
}

@ -56,10 +56,10 @@ class TestStoragePartition : public StoragePartition {
}
network::mojom::NetworkContext* GetNetworkContext() override;
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactoryForBrowserProcess()
override;
scoped_refptr<network::SharedURLLoaderFactory>
GetURLLoaderFactoryForBrowserProcess() override;
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
GetURLLoaderFactoryForBrowserProcessIOThread() override;
void set_cookie_manager_for_browser_process(

@ -24,6 +24,7 @@
#include "content/shell/browser/shell.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"

@ -18,6 +18,7 @@
#include "net/http/http_request_headers.h"
#include "net/url_request/url_request_context.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/WebString.h"
@ -66,7 +67,7 @@ class ResourceFetcherImpl::ClientImpl : public network::mojom::URLLoaderClient {
}
void Start(const network::ResourceRequest& request,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const net::NetworkTrafficAnnotationTag& annotation_tag,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
status_ = Status::kStarted;
@ -288,7 +289,7 @@ void ResourceFetcherImpl::SetHeader(const std::string& header,
void ResourceFetcherImpl::Start(
blink::WebLocalFrame* frame,
blink::WebURLRequest::RequestContext request_context,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const net::NetworkTrafficAnnotationTag& annotation_tag,
Callback callback,
size_t maximum_download_size) {

@ -33,7 +33,7 @@ class ResourceFetcherImpl : public ResourceFetcher {
void SetHeader(const std::string& header, const std::string& value) override;
void Start(blink::WebLocalFrame* frame,
blink::WebURLRequest::RequestContext request_context,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const net::NetworkTrafficAnnotationTag& annotation_tag,
Callback callback,
size_t maximum_download_size) override;

@ -108,7 +108,7 @@ ChildURLLoaderFactoryBundleInfo::ChildURLLoaderFactoryBundleInfo(
ChildURLLoaderFactoryBundleInfo::~ChildURLLoaderFactoryBundleInfo() = default;
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
ChildURLLoaderFactoryBundleInfo::CreateFactory() {
auto other = std::make_unique<ChildURLLoaderFactoryBundleInfo>();
other->default_factory_info_ = std::move(default_factory_info_);
@ -186,7 +186,7 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
traffic_annotation);
}
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
ChildURLLoaderFactoryBundle::Clone() {
InitDefaultBlobFactoryIfNecessary();
InitDirectNetworkFactoryIfNecessary();

@ -38,7 +38,7 @@ class CONTENT_EXPORT ChildURLLoaderFactoryBundleInfo
protected:
// URLLoaderFactoryBundleInfo overrides.
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
PossiblyAssociatedURLLoaderFactoryPtrInfo direct_network_factory_info_;
@ -81,7 +81,7 @@ class CONTENT_EXPORT ChildURLLoaderFactoryBundle
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<ChildURLLoaderFactoryBundleInfo> PassInterface();

@ -377,11 +377,11 @@ void ResourceDispatcher::StartSync(
const url::Origin& frame_origin,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
SyncLoadResponse* response,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) {
CheckSchemeForReferrerPolicy(*request);
std::unique_ptr<SharedURLLoaderFactoryInfo> factory_info =
std::unique_ptr<network::SharedURLLoaderFactoryInfo> factory_info =
url_loader_factory->Clone();
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
@ -415,7 +415,7 @@ int ResourceDispatcher::StartAsync(
const net::NetworkTrafficAnnotationTag& traffic_annotation,
bool is_sync,
std::unique_ptr<RequestPeer> peer,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
base::OnceClosure* continue_navigation_function) {

@ -23,11 +23,11 @@
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/common/url_loader_throttle.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/request_priority.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "url/gurl.h"
@ -88,7 +88,7 @@ class CONTENT_EXPORT ResourceDispatcher {
const url::Origin& frame_origin,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
SyncLoadResponse* response,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles);
// Call this method to initiate the request. If this method succeeds, then
@ -108,7 +108,7 @@ class CONTENT_EXPORT ResourceDispatcher {
const net::NetworkTrafficAnnotationTag& traffic_annotation,
bool is_sync,
std::unique_ptr<RequestPeer> peer,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
base::OnceClosure* continue_navigation_function);

@ -23,7 +23,8 @@ void SyncLoadContext::StartAsyncWithWaitableEvent(
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
const url::Origin& frame_origin,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
SyncLoadResponse* response,
base::WaitableEvent* event) {
@ -41,13 +42,13 @@ void SyncLoadContext::StartAsyncWithWaitableEvent(
SyncLoadContext::SyncLoadContext(
network::ResourceRequest* request,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory,
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory,
SyncLoadResponse* response,
base::WaitableEvent* event,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: response_(response), event_(event), task_runner_(std::move(task_runner)) {
url_loader_factory_ =
SharedURLLoaderFactory::Create(std::move(url_loader_factory));
network::SharedURLLoaderFactory::Create(std::move(url_loader_factory));
// Constructs a new ResourceDispatcher specifically for this request.
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();

@ -6,10 +6,10 @@
#define CONTENT_RENDERER_LOADER_SYNC_LOAD_CONTEXT_H_
#include "base/macros.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/renderer/request_peer.h"
#include "content/renderer/loader/resource_dispatcher.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace base {
class WaitableEvent;
@ -40,14 +40,15 @@ class SyncLoadContext : public RequestPeer {
scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
const url::Origin& frame_origin,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
SyncLoadResponse* response,
base::WaitableEvent* event);
SyncLoadContext(
network::ResourceRequest* request,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory,
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory,
SyncLoadResponse* response,
base::WaitableEvent* event,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
@ -73,7 +74,7 @@ class SyncLoadContext : public RequestPeer {
base::WaitableEvent* event_;
// State necessary to run a request on an independent thread.
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
int request_id_;

@ -25,7 +25,7 @@ TrackedChildURLLoaderFactoryBundleInfo::TrackedChildURLLoaderFactoryBundleInfo(
TrackedChildURLLoaderFactoryBundleInfo::
~TrackedChildURLLoaderFactoryBundleInfo() = default;
scoped_refptr<SharedURLLoaderFactory>
scoped_refptr<network::SharedURLLoaderFactory>
TrackedChildURLLoaderFactoryBundleInfo::CreateFactory() {
auto other = std::make_unique<TrackedChildURLLoaderFactoryBundleInfo>();
other->default_factory_info_ = std::move(default_factory_info_);
@ -51,7 +51,7 @@ TrackedChildURLLoaderFactoryBundle::~TrackedChildURLLoaderFactoryBundle() {
RemoveObserverOnMainThread();
};
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
TrackedChildURLLoaderFactoryBundle::Clone() {
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
ChildURLLoaderFactoryBundle::Clone().release()));
@ -96,7 +96,7 @@ void TrackedChildURLLoaderFactoryBundle::RemoveObserverOnMainThread() {
}
void TrackedChildURLLoaderFactoryBundle::OnUpdate(
std::unique_ptr<SharedURLLoaderFactoryInfo> info) {
std::unique_ptr<network::SharedURLLoaderFactoryInfo> info) {
Update(base::WrapUnique(
static_cast<ChildURLLoaderFactoryBundleInfo*>(info.release())),
base::nullopt);
@ -112,7 +112,7 @@ HostChildURLLoaderFactoryBundle::HostChildURLLoaderFactoryBundle()
HostChildURLLoaderFactoryBundle::~HostChildURLLoaderFactoryBundle() = default;
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
HostChildURLLoaderFactoryBundle::Clone() {
auto info = base::WrapUnique(static_cast<ChildURLLoaderFactoryBundleInfo*>(
ChildURLLoaderFactoryBundle::Clone().release()));
@ -168,7 +168,7 @@ void HostChildURLLoaderFactoryBundle::RemoveObserver(
void HostChildURLLoaderFactoryBundle::NotifyUpdateOnMainOrWorkerThread(
ObserverPtrAndTaskRunner* observer_bundle,
std::unique_ptr<SharedURLLoaderFactoryInfo> update_info) {
std::unique_ptr<network::SharedURLLoaderFactoryInfo> update_info) {
observer_bundle->second->PostTask(
FROM_HERE,
base::BindOnce(&TrackedChildURLLoaderFactoryBundle::OnUpdate,

@ -36,7 +36,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundleInfo
protected:
// ChildURLLoaderFactoryBundleInfo overrides.
scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override;
std::unique_ptr<HostPtrAndTaskRunner> main_thread_host_bundle_;
@ -66,7 +66,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundle
// ChildURLLoaderFactoryBundle overrides.
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
private:
friend class HostChildURLLoaderFactoryBundle;
@ -83,7 +83,7 @@ class CONTENT_EXPORT TrackedChildURLLoaderFactoryBundle
void RemoveObserverOnMainThread();
// Callback method to receive updates from the host bundle.
void OnUpdate(std::unique_ptr<SharedURLLoaderFactoryInfo> info);
void OnUpdate(std::unique_ptr<network::SharedURLLoaderFactoryInfo> info);
// |WeakPtr| and |TaskRunner| of the host bundle. Can be copied and passed
// across sequences.
@ -111,7 +111,7 @@ class CONTENT_EXPORT HostChildURLLoaderFactoryBundle
// ChildURLLoaderFactoryBundle overrides.
// Returns |std::unique_ptr<TrackedChildURLLoaderFactoryBundleInfo>|.
std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override;
bool IsHostChildURLLoaderFactoryBundle() const override;
// Update this bundle with |info|, and post cloned |info| to tracked bundles.
@ -140,7 +140,7 @@ class CONTENT_EXPORT HostChildURLLoaderFactoryBundle
// tracked bundle has been destroyed.
void NotifyUpdateOnMainOrWorkerThread(
ObserverPtrAndTaskRunner* observer_bundle,
std::unique_ptr<SharedURLLoaderFactoryInfo> update_info);
std::unique_ptr<network::SharedURLLoaderFactoryInfo> update_info);
// Contains |WeakPtr| and |TaskRunner| to tracked bundles.
std::unique_ptr<ObserverList> observer_list_ = nullptr;

@ -359,7 +359,7 @@ StreamOverrideParameters::~StreamOverrideParameters() {
WebURLLoaderFactoryImpl::WebURLLoaderFactoryImpl(
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
scoped_refptr<SharedURLLoaderFactory> loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> loader_factory)
: resource_dispatcher_(std::move(resource_dispatcher)),
loader_factory_(std::move(loader_factory)) {}
@ -399,7 +399,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
Context(WebURLLoaderImpl* loader,
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> factory,
scoped_refptr<network::SharedURLLoaderFactory> factory,
mojom::KeepAliveHandlePtr keep_alive_handle);
ResourceDispatcher* resource_dispatcher() { return resource_dispatcher_; }
@ -463,7 +463,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
DeferState defers_loading_;
int request_id_;
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
};
// A thin wrapper class for Context to ensure its lifetime while it is
@ -526,7 +526,7 @@ WebURLLoaderImpl::Context::Context(
WebURLLoaderImpl* loader,
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
mojom::KeepAliveHandlePtr keep_alive_handle_ptr)
: loader_(loader),
use_stream_on_response_(false),
@ -1141,7 +1141,7 @@ void WebURLLoaderImpl::RequestPeerImpl::OnCompletedRequest(
WebURLLoaderImpl::WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: WebURLLoaderImpl(resource_dispatcher,
std::move(task_runner),
std::move(url_loader_factory),
@ -1150,7 +1150,7 @@ WebURLLoaderImpl::WebURLLoaderImpl(
WebURLLoaderImpl::WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
mojom::KeepAliveHandlePtr keep_alive_handle)
: context_(new Context(this,
resource_dispatcher,

@ -12,10 +12,10 @@
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "content/common/frame.mojom.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "third_party/WebKit/public/platform/WebURLLoader.h"
@ -56,8 +56,9 @@ struct CONTENT_EXPORT StreamOverrideParameters {
class CONTENT_EXPORT WebURLLoaderFactoryImpl
: public blink::WebURLLoaderFactory {
public:
WebURLLoaderFactoryImpl(base::WeakPtr<ResourceDispatcher> resource_dispatcher,
scoped_refptr<SharedURLLoaderFactory> loader_factory);
WebURLLoaderFactoryImpl(
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
scoped_refptr<network::SharedURLLoaderFactory> loader_factory);
~WebURLLoaderFactoryImpl() override;
// Creates a test-only factory which can be used only for data URLs.
@ -69,21 +70,23 @@ class CONTENT_EXPORT WebURLLoaderFactoryImpl
private:
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
DISALLOW_COPY_AND_ASSIGN(WebURLLoaderFactoryImpl);
};
class CONTENT_EXPORT WebURLLoaderImpl : public blink::WebURLLoader {
public:
WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory);
WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
// When non-null |keep_alive_handle| is specified, this loader prolongs
// this render process's lifetime.
WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
mojom::KeepAliveHandlePtr keep_alive_handle);
WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
mojom::KeepAliveHandlePtr keep_alive_handle);
~WebURLLoaderImpl() override;
static void PopulateURLResponse(const blink::WebURL& url,

@ -76,7 +76,7 @@ class TestResourceDispatcher : public ResourceDispatcher {
const url::Origin& frame_origin,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
SyncLoadResponse* response,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) override {
*response = sync_load_response_;
}
@ -89,7 +89,7 @@ class TestResourceDispatcher : public ResourceDispatcher {
const net::NetworkTrafficAnnotationTag& traffic_annotation,
bool is_sync,
std::unique_ptr<RequestPeer> peer,
scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
base::OnceClosure* continue_navigation_function) override {

@ -3570,7 +3570,7 @@ RenderFrameImpl::CreateWorkerFetchContext() {
}
RenderThreadImpl* render_thread = RenderThreadImpl::current();
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
direct_network_loader_factory_info;
// Could be null in tests.
if (render_thread) {
@ -4097,7 +4097,7 @@ void RenderFrameImpl::DidCreateDocumentLoader(
return;
RenderThreadImpl* render_thread = RenderThreadImpl::current();
scoped_refptr<SharedURLLoaderFactory> direct_network_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> direct_network_loader_factory;
if (render_thread) {
direct_network_loader_factory =
base::MakeRefCounted<PossiblyAssociatedWrapperSharedURLLoaderFactory>(
@ -7318,7 +7318,8 @@ void RenderFrameImpl::SetAccessibilityModeForTest(ui::AXMode new_mode) {
OnSetAccessibilityMode(new_mode);
}
scoped_refptr<SharedURLLoaderFactory> RenderFrameImpl::GetURLLoaderFactory() {
scoped_refptr<network::SharedURLLoaderFactory>
RenderFrameImpl::GetURLLoaderFactory() {
return GetLoaderFactoryBundle();
}

@ -500,7 +500,7 @@ class CONTENT_EXPORT RenderFrameImpl
blink::TaskType task_type) override;
int GetEnabledBindings() const override;
void SetAccessibilityModeForTest(ui::AXMode new_mode) override;
scoped_refptr<SharedURLLoaderFactory> GetURLLoaderFactory() override;
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
// blink::mojom::EngagementClient implementation:
void SetEngagementLevel(const url::Origin& origin,

@ -18,7 +18,8 @@ namespace content {
ServiceWorkerFetchContextImpl::ServiceWorkerFetchContextImpl(
const GURL& worker_script_url,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
int service_worker_provider_id,
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
: worker_script_url_(worker_script_url),
@ -31,8 +32,8 @@ ServiceWorkerFetchContextImpl::~ServiceWorkerFetchContextImpl() {}
void ServiceWorkerFetchContextImpl::InitializeOnWorkerThread() {
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
url_loader_factory_ =
SharedURLLoaderFactory::Create(std::move(url_loader_factory_info_));
url_loader_factory_ = network::SharedURLLoaderFactory::Create(
std::move(url_loader_factory_info_));
}
std::unique_ptr<blink::WebURLLoaderFactory>

@ -5,7 +5,7 @@
#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
#include "url/gurl.h"
@ -17,7 +17,8 @@ class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext {
public:
ServiceWorkerFetchContextImpl(
const GURL& worker_script_url,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
int service_worker_provider_id,
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
~ServiceWorkerFetchContextImpl() override;
@ -34,12 +35,12 @@ class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext {
private:
const GURL worker_script_url_;
// Consumed on the worker thread to create |url_loader_factory_|.
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info_;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info_;
const int service_worker_provider_id_;
// Initialized on the worker thread when InitializeOnWorkerThread() is called.
std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
scoped_refptr<SharedURLLoaderFactory> url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider_;
};

@ -12,13 +12,13 @@
#include "content/common/service_worker/service_worker_utils.h"
#include "content/common/weak_wrapper_shared_url_loader_factory.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/renderer/loader/request_extra_data.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/service_worker/service_worker_dispatcher.h"
#include "content/renderer/service_worker/service_worker_provider_context.h"
#include "ipc/ipc_sync_channel.h"
#include "mojo/public/cpp/bindings/associated_group.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/WebKit/public/common/frame/sandbox_flags.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
@ -149,7 +149,7 @@ ServiceWorkerNetworkProvider::CreateForNavigation(
blink::WebLocalFrame* frame,
bool content_initiated,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory) {
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory) {
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
bool should_create_provider_for_window = false;
int service_worker_provider_id = kInvalidServiceWorkerProviderId;
@ -266,7 +266,7 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
int browser_provider_id,
bool is_parent_frame_secure,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory) {
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory) {
if (browser_provider_id == kInvalidServiceWorkerProviderId)
return;

@ -25,6 +25,10 @@ class WebLocalFrame;
class WebServiceWorkerNetworkProvider;
} // namespace blink
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace content {
namespace mojom {
@ -33,7 +37,6 @@ class URLLoaderFactory;
struct RequestNavigationParams;
class ServiceWorkerProviderContext;
class SharedURLLoaderFactory;
class ThreadSafeSender;
// ServiceWorkerNetworkProvider enables the browser process to recognize
@ -71,7 +74,7 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
blink::WebLocalFrame* frame,
bool content_initiated,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
// Creates a ServiceWorkerNetworkProvider for a shared worker (as a
// non-document service worker client).
@ -120,7 +123,7 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
int provider_id,
bool is_parent_frame_secure,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
// This is for controllers, used in CreateForController.
explicit ServiceWorkerNetworkProvider(

@ -17,7 +17,6 @@
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/service_names.mojom.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/renderer/service_worker/controller_service_worker_connector.h"
#include "content/renderer/service_worker/service_worker_dispatcher.h"
#include "content/renderer/service_worker/service_worker_subresource_loader.h"
@ -26,6 +25,7 @@
#include "content/renderer/worker_thread_registry.h"
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_provider.h"
@ -37,7 +37,7 @@ namespace content {
// Holds state for service worker clients.
struct ServiceWorkerProviderContext::ProviderStateForClient {
explicit ProviderStateForClient(
scoped_refptr<SharedURLLoaderFactory> default_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory)
: default_loader_factory(std::move(default_loader_factory)) {}
~ProviderStateForClient() = default;
@ -53,7 +53,7 @@ struct ServiceWorkerProviderContext::ProviderStateForClient {
// S13nServiceWorker:
// Used when we create |subresource_loader_factory|.
scoped_refptr<SharedURLLoaderFactory> default_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory;
// Tracks feature usage for UseCounter.
std::set<blink::mojom::WebFeature> used_features;
@ -100,7 +100,7 @@ ServiceWorkerProviderContext::ServiceWorkerProviderContext(
mojom::ServiceWorkerContainerAssociatedRequest request,
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory)
: provider_type_(provider_type),
provider_id_(provider_id),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),

@ -15,9 +15,9 @@
#include "content/common/service_worker/controller_service_worker.mojom.h"
#include "content/common/service_worker/service_worker_container.mojom.h"
#include "content/common/service_worker/service_worker_provider.mojom.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/renderer/service_worker/web_service_worker_provider_impl.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom.h"
@ -80,7 +80,7 @@ class CONTENT_EXPORT ServiceWorkerProviderContext
mojom::ServiceWorkerContainerAssociatedRequest request,
mojom::ServiceWorkerContainerHostAssociatedPtrInfo host_ptr_info,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<SharedURLLoaderFactory> default_loader_factory);
scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory);
// Constructor for service worker execution contexts.
ServiceWorkerProviderContext(

@ -17,7 +17,6 @@
#include "content/common/wrapper_shared_url_loader_factory.h"
#include "content/public/common/content_features.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/renderer/service_worker/controller_service_worker_connector.h"
#include "content/renderer/service_worker/service_worker_dispatcher.h"
#include "content/renderer/service_worker/service_worker_provider_context.h"
@ -28,6 +27,7 @@
#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/test/test_url_loader_client.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -327,7 +327,7 @@ class ServiceWorkerProviderContextTest : public testing::Test {
// S13nServiceWorker:
base::test::ScopedFeatureList scoped_feature_list_;
FakeURLLoaderFactory fake_loader_factory_;
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContextTest);
};

@ -12,13 +12,13 @@
#include "content/common/service_worker/service_worker_types.h"
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/common/content_features.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/renderer/service_worker/controller_service_worker_connector.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/url_request/redirect_info.h"
#include "net/url_request/redirect_util.h"
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "ui/base/page_transition_types.h"
namespace content {
@ -171,7 +171,7 @@ ServiceWorkerSubresourceLoader::ServiceWorkerSubresourceLoader(
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory)
: redirect_limit_(net::URLRequest::kMaxRedirects),
url_loader_client_(std::move(client)),
url_loader_binding_(this, std::move(request)),
@ -543,7 +543,7 @@ void ServiceWorkerSubresourceLoader::OnBlobReadingComplete(int net_error) {
ServiceWorkerSubresourceLoaderFactory::ServiceWorkerSubresourceLoaderFactory(
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory)
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory)
: controller_connector_(std::move(controller_connector)),
network_loader_factory_(std::move(network_loader_factory)) {
DCHECK(network_loader_factory_);

@ -21,9 +21,12 @@
#include "third_party/WebKit/public/mojom/service_worker/service_worker_event_status.mojom.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_stream_handle.mojom.h"
namespace network {
class SharedURLLoaderFactory;
} // namespace network
namespace content {
class SharedURLLoaderFactory;
class ControllerServiceWorkerConnector;
// S13nServiceWorker:
@ -47,7 +50,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoader
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory);
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory);
~ServiceWorkerSubresourceLoader() override;
@ -134,7 +137,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoader
std::unique_ptr<StreamWaiter> stream_waiter_;
// For network fallback.
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
enum class Status {
kNotStarted,
@ -163,7 +166,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoaderFactory
// any custom URLLoader factories.
ServiceWorkerSubresourceLoaderFactory(
scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
scoped_refptr<SharedURLLoaderFactory> network_loader_factory);
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory);
~ServiceWorkerSubresourceLoaderFactory() override;
@ -183,7 +186,7 @@ class CONTENT_EXPORT ServiceWorkerSubresourceLoaderFactory
// A URLLoaderFactory that directly goes to network, used when a request
// falls back to network.
scoped_refptr<SharedURLLoaderFactory> network_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerSubresourceLoaderFactory);
};

@ -12,7 +12,6 @@
#include "content/common/wrapper_shared_url_loader_factory.h"
#include "content/public/common/content_features.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/renderer/service_worker/controller_service_worker_connector.h"
#include "mojo/common/data_pipe_utils.h"
@ -22,6 +21,7 @@
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/test/test_data_pipe_getter.h"
#include "services/network/test/test_url_loader_client.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -451,7 +451,7 @@ class ServiceWorkerSubresourceLoaderTest : public ::testing::Test {
}
TestBrowserThreadBundle thread_bundle_;
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
scoped_refptr<ControllerServiceWorkerConnector> connector_;
FakeServiceWorkerContainerHost fake_container_host_;
FakeControllerServiceWorker fake_controller_;

@ -29,8 +29,9 @@ namespace content {
class WorkerFetchContextImpl::URLLoaderFactoryImpl
: public blink::WebURLLoaderFactory {
public:
URLLoaderFactoryImpl(base::WeakPtr<ResourceDispatcher> resource_dispatcher,
scoped_refptr<SharedURLLoaderFactory> loader_factory)
URLLoaderFactoryImpl(
base::WeakPtr<ResourceDispatcher> resource_dispatcher,
scoped_refptr<network::SharedURLLoaderFactory> loader_factory)
: resource_dispatcher_(std::move(resource_dispatcher)),
loader_factory_(std::move(loader_factory)),
weak_ptr_factory_(this) {}
@ -87,8 +88,9 @@ class WorkerFetchContextImpl::URLLoaderFactoryImpl
}
base::WeakPtr<ResourceDispatcher> resource_dispatcher_;
scoped_refptr<SharedURLLoaderFactory> loader_factory_;
scoped_refptr<SharedURLLoaderFactory> service_worker_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory>
service_worker_url_loader_factory_;
base::WeakPtrFactory<URLLoaderFactoryImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
};
@ -96,8 +98,10 @@ class WorkerFetchContextImpl::URLLoaderFactoryImpl
WorkerFetchContextImpl::WorkerFetchContextImpl(
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<SharedURLLoaderFactoryInfo> direct_network_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
direct_network_factory_info,
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider)
: binding_(this),
service_worker_client_request_(std::move(service_worker_client_request)),
@ -122,9 +126,9 @@ void WorkerFetchContextImpl::InitializeOnWorkerThread() {
DCHECK(!binding_.is_bound());
resource_dispatcher_ = std::make_unique<ResourceDispatcher>();
shared_url_loader_factory_ =
SharedURLLoaderFactory::Create(std::move(url_loader_factory_info_));
direct_network_loader_factory_ = SharedURLLoaderFactory::Create(
shared_url_loader_factory_ = network::SharedURLLoaderFactory::Create(
std::move(url_loader_factory_info_));
direct_network_loader_factory_ = network::SharedURLLoaderFactory::Create(
std::move(direct_network_loader_factory_info_));
if (service_worker_client_request_.is_pending())
binding_.Bind(std::move(service_worker_client_request_));

@ -7,9 +7,9 @@
#include "content/common/service_worker/service_worker_provider.mojom.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/public/common/shared_url_loader_factory.h"
#include "ipc/ipc_message.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "third_party/WebKit/public/mojom/blob/blob_registry.mojom.h"
#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h"
@ -45,8 +45,10 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
mojom::ServiceWorkerWorkerClientRequest service_worker_client_request,
mojom::ServiceWorkerContainerHostPtrInfo
service_worker_container_host_info,
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info,
std::unique_ptr<SharedURLLoaderFactoryInfo> direct_network_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
url_loader_factory_info,
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
direct_network_factory_info,
std::unique_ptr<URLLoaderThrottleProvider> throttle_provider);
~WorkerFetchContextImpl() override;
@ -104,9 +106,9 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
// Consumed on the worker thread to create |service_worker_container_host_|.
mojom::ServiceWorkerContainerHostPtrInfo service_worker_container_host_info_;
// Consumed on the worker thread to create |shared_url_loader_factory_|.
std::unique_ptr<SharedURLLoaderFactoryInfo> url_loader_factory_info_;
std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info_;
// Consumed on the worker thread to create |direct_network_loader_factory_|.
std::unique_ptr<SharedURLLoaderFactoryInfo>
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
direct_network_loader_factory_info_;
// Consumed on the worker thread to create |blob_registry_|.
blink::mojom::BlobRegistryPtrInfo blob_registry_ptr_info_;
@ -127,8 +129,8 @@ class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
// specifically to initialize ServiceWorkerSubresourceLoader for network
// load that is controlled by a service worker (when this worker is a
// client of the service worker).
scoped_refptr<SharedURLLoaderFactory> shared_url_loader_factory_;
scoped_refptr<SharedURLLoaderFactory> direct_network_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> direct_network_loader_factory_;
// S13nServiceWorker:
// Initialized on the worker thread when InitializeOnWorkerThread() is called.

@ -26,6 +26,8 @@ component("cpp") {
"net_adapters.h",
"network_switches.cc",
"network_switches.h",
"shared_url_loader_factory.cc",
"shared_url_loader_factory.h",
"simple_url_loader.cc",
"simple_url_loader.h",
"simple_url_loader_stream_consumer.h",

@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/common/shared_url_loader_factory.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
namespace network {
// static
scoped_refptr<SharedURLLoaderFactory> SharedURLLoaderFactory::Create(
@ -25,4 +25,4 @@ SharedURLLoaderFactoryInfo::SharedURLLoaderFactoryInfo() = default;
SharedURLLoaderFactoryInfo::~SharedURLLoaderFactoryInfo() = default;
} // namespace content
} // namespace network

@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
#define CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
#ifndef SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_
#define SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_
#include <memory>
#include "base/component_export.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
namespace network {
class SharedURLLoaderFactoryInfo;
@ -25,7 +25,7 @@ class SharedURLLoaderFactoryInfo;
// resulting SharedURLLoaderFactoryInfo instance to the target sequence. On the
// target sequence, call SharedURLLoaderFactory::Create() to convert the info
// instance to a new SharedURLLoaderFactory.
class CONTENT_EXPORT SharedURLLoaderFactory
class COMPONENT_EXPORT(NETWORK_CPP) SharedURLLoaderFactory
: public base::RefCounted<SharedURLLoaderFactory>,
public network::mojom::URLLoaderFactory {
public:
@ -46,7 +46,7 @@ class CONTENT_EXPORT SharedURLLoaderFactory
// SharedURLLoaderFactory. It is not sequence safe but can be passed across
// sequences. Please see the comments of SharedURLLoaderFactory for how this
// class is used.
class CONTENT_EXPORT SharedURLLoaderFactoryInfo {
class COMPONENT_EXPORT(NETWORK_CPP) SharedURLLoaderFactoryInfo {
public:
SharedURLLoaderFactoryInfo();
virtual ~SharedURLLoaderFactoryInfo();
@ -63,6 +63,6 @@ class CONTENT_EXPORT SharedURLLoaderFactoryInfo {
DISALLOW_COPY_AND_ASSIGN(SharedURLLoaderFactoryInfo);
};
} // namespace content
} // namespace network
#endif // CONTENT_PUBLIC_COMMON_SHARED_URL_LOADER_FACTORY_H_
#endif // SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_