blob: 1d217213c1be96acbe25048f8005f3f20ae7ef78 [file] [log] [blame]
Avi Drissman64595482022-09-14 20:52:291// Copyright 2014 The Chromium Authors
[email protected]3b90aab2014-05-30 17:56:152// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
6#define NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
7
Matt Menkefd978852020-09-15 16:00:578#include <memory>
9
[email protected]3b90aab2014-05-30 17:56:1510#include "net/base/net_export.h"
11
12namespace net {
13
14class URLRequest;
15class URLRequestJob;
[email protected]3b90aab2014-05-30 17:56:1516
Matt Menkec6c988e2019-09-11 02:30:4017// In tests, URLRequestFilter lets URLRequestInterceptors create URLRequestJobs
18// to handle URLRequests before they're handed off to the ProtocolHandler for
[email protected]3b90aab2014-05-30 17:56:1519// the request's scheme.
Matt Menkec6c988e2019-09-11 02:30:4020//
21// TODO(mmenke): Only include this file in test targets. Also consider using
22// callbacks instead, or even removing URLRequestFilter.
[email protected]3b90aab2014-05-30 17:56:1523class NET_EXPORT URLRequestInterceptor {
24 public:
25 URLRequestInterceptor();
Peter Boström293b1342021-09-22 17:31:4326
27 URLRequestInterceptor(const URLRequestInterceptor&) = delete;
28 URLRequestInterceptor& operator=(const URLRequestInterceptor&) = delete;
29
[email protected]3b90aab2014-05-30 17:56:1530 virtual ~URLRequestInterceptor();
31
32 // Returns a URLRequestJob to handle |request|, if the interceptor wants to
33 // take over the handling the request instead of the default ProtocolHandler.
Matt Menkefd978852020-09-15 16:00:5734 // Otherwise, returns nullptr.
35 virtual std::unique_ptr<URLRequestJob> MaybeInterceptRequest(
36 URLRequest* request) const = 0;
[email protected]3b90aab2014-05-30 17:56:1537};
38
39} // namespace net
40
41#endif // NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_