blob: a8ce48f05cf95195219708d3507070e8774a8dbe [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_
#define CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
namespace content {
class ResourceRequesterInfo;
// This class is an implementation of network::mojom::URLLoaderFactory that
// creates a network::mojom::URLLoader.
class CONTENT_EXPORT URLLoaderFactoryImpl final
: public network::mojom::URLLoaderFactory {
public:
explicit URLLoaderFactoryImpl(
scoped_refptr<ResourceRequesterInfo> requester_info);
~URLLoaderFactoryImpl() override;
void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
int32_t routing_id,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& url_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
void Clone(network::mojom::URLLoaderFactoryRequest request) override;
private:
mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
scoped_refptr<ResourceRequesterInfo> requester_info_;
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
};
} // namespace content
#endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_