Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: content/public/child/url_loader_throttle.h

Issue 2914423002: Network service: move URLLoaderThrottle and ThrottlingURLLoader. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/child/BUILD.gn ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
6 #define CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
7
8 #include "content/common/content_export.h"
9 #include "content/public/common/resource_type.h"
10
11 class GURL;
12
13 namespace net {
14 struct RedirectInfo;
15 }
16
17 namespace content {
18
19 // A URLLoaderThrottle gets notified at various points during the process of
20 // loading a resource. At each stage, it has the opportunity to defer the
21 // resource load.
22 class CONTENT_EXPORT URLLoaderThrottle {
23 public:
24 // An interface for the throttle implementation to resume (when deferred) or
25 // cancel the resource load.
26 class CONTENT_EXPORT Delegate {
27 public:
28 // Cancels the resource load with the specified error code.
29 virtual void CancelWithError(int error_code) = 0;
30
31 // Resumes the deferred resource load. It is a no-op if the resource load is
32 // not deferred or has already been canceled.
33 virtual void Resume() = 0;
34
35 protected:
36 virtual ~Delegate() {}
37 };
38
39 virtual ~URLLoaderThrottle() {}
40
41 // Called before the resource request is started.
42 virtual void WillStartRequest(const GURL& url,
43 int load_flags,
44 ResourceType resource_type,
45 bool* defer) {}
46
47 // Called when the request was redirected. |redirect_info| contains the
48 // redirect responses's HTTP status code and some information about the new
49 // request that will be sent if the redirect is followed, including the new
50 // URL and new method.
51 virtual void WillRedirectRequest(const net::RedirectInfo& redirect_info,
52 bool* defer) {}
53
54 // Called when the response headers and meta data are available.
55 virtual void WillProcessResponse(bool* defer) {}
56
57 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
58
59 protected:
60 URLLoaderThrottle() = default;
61
62 Delegate* delegate_ = nullptr;
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
OLDNEW
« no previous file with comments | « content/public/child/BUILD.gn ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698