blob: cb79099428aabb75a2c0cfa07c10b485c3d98c84 [file] [log] [blame]
// Copyright 2017 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 SERVICES_NETWORK_URL_LOADER_FACTORY_H_
#define SERVICES_NETWORK_URL_LOADER_FACTORY_H_
#include "base/macros.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/interfaces/url_loader_factory.mojom.h"
namespace network {
class NetworkContext;
// This class is an implementation of mojom::URLLoaderFactory that
// creates a mojom::URLLoader.
class URLLoaderFactory : public mojom::URLLoaderFactory {
public:
// NOTE: |context| must outlive this instance.
URLLoaderFactory(NetworkContext* context, uint32_t process_id);
~URLLoaderFactory() override;
// mojom::URLLoaderFactory implementation.
void CreateLoaderAndStart(mojom::URLLoaderRequest request,
int32_t routing_id,
int32_t request_id,
uint32_t options,
const ResourceRequest& url_request,
mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag&
traffic_annotation) override;
void Clone(mojom::URLLoaderFactoryRequest request) override;
private:
// Not owned.
NetworkContext* context_;
uint32_t process_id_;
DISALLOW_COPY_AND_ASSIGN(URLLoaderFactory);
};
} // namespace network
#endif // SERVICES_NETWORK_URL_LOADER_FACTORY_H_