blob: d0ead39a3d0e0c3edd697c13d976a7fec49b4ecf [file] [log] [blame]
// Copyright 2018 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.
#include <memory>
#include <vector>
#include "content/common/content_export.h"
#include "content/public/common/resource_type.h"
#include "content/public/common/url_loader_throttle.h"
#include "third_party/blink/public/platform/web_url_request.h"
namespace content {
enum class URLLoaderThrottleProviderType {
// Used for requests from frames. Please note that the requests could be
// frame or subresource requests.
// Used for requests from workers, including dedicated, shared and service
// workers.
class CONTENT_EXPORT URLLoaderThrottleProvider {
virtual ~URLLoaderThrottleProvider() {}
// Used to copy a URLLoaderThrottleProvider between worker threads.
virtual std::unique_ptr<URLLoaderThrottleProvider> Clone() = 0;
// For requests from frames and dedicated workers, |render_frame_id| should be
// set to the corresponding frame. For requests from shared or
// service workers, |render_frame_id| should be set to MSG_ROUTING_NONE.
virtual std::vector<std::unique_ptr<URLLoaderThrottle>> CreateThrottles(
int render_frame_id,
const blink::WebURLRequest& request,
ResourceType resource_type) = 0;
// Set the network status online state as specified in |is_online|.
virtual void SetOnline(bool is_online) = 0;
} // namespace content