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

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

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (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
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 <memory>
9
10 #include "content/common/content_export.h"
11 #include "content/public/common/resource_response.h"
12 #include "content/public/common/resource_type.h"
13
14 class GURL;
15
16 namespace net {
17 struct RedirectInfo;
18 }
19
20 namespace content {
21
22 class CONTENT_EXPORT URLLoaderThrottle {
jam 2017/05/25 15:45:51 nit: please document
yzshen1 2017/05/26 20:43:52 Done.
23 public:
24 // An interface to get notified when the throttle implementation considers
25 // it's ready to resume or cancel the deferred resource load.
26 class CONTENT_EXPORT Delegate {
jam 2017/05/25 15:45:51 nit: export not needed since it's not copyable
yzshen1 2017/05/26 20:43:52 Done.
27 public:
28 // Cancels the resource load with the specified error code.
29 virtual void CancelWithError(int error_code) = 0;
30 // Resumes the deferred resource load. It is a no-op if the resource load is
jam 2017/05/25 15:45:51 nit: blank line above
yzshen1 2017/05/26 20:43:52 Done.
31 // not deferred or has already been canceled.
32 virtual void Resume() = 0;
33
34 protected:
35 virtual ~Delegate() {}
36 };
37
38 virtual ~URLLoaderThrottle() {}
39
40 // Called before the resource request is started.
41 virtual void WillStartRequest(const GURL& url,
42 int load_flags,
43 ResourceType resource_type,
44 bool* defer) {}
45
46 // Called when the request was redirected. |redirect_info| contains the
47 // redirect responses's HTTP status code and some information about the new
48 // request that will be sent if the redirect is followed, including the new
49 // URL and new method.
50 virtual void WillRedirectRequest(const net::RedirectInfo& redirect_info,
51 bool* defer) {}
52
53 // Called when the response headers and meta data are available.
54 virtual void WillProcessResponse(bool* defer) {}
55
56 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
57
58 protected:
59 URLLoaderThrottle() = default;
60
61 Delegate* delegate_ = nullptr;
62 };
63
64 } // namespace content
65
66 #endif // CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698