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

Side by Side Diff: net/base/network_delegate.h

Issue 1692503002: Functionality to allow blacklist and whitelist of custom schemes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused comments Created 4 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // OnAuthRequired call. It's placed in this file to prevent url_request.h 48 // OnAuthRequired call. It's placed in this file to prevent url_request.h
49 // from having to include network_delegate.h. 49 // from having to include network_delegate.h.
50 enum AuthRequiredResponse { 50 enum AuthRequiredResponse {
51 AUTH_REQUIRED_RESPONSE_NO_ACTION, 51 AUTH_REQUIRED_RESPONSE_NO_ACTION,
52 AUTH_REQUIRED_RESPONSE_SET_AUTH, 52 AUTH_REQUIRED_RESPONSE_SET_AUTH,
53 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, 53 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
54 AUTH_REQUIRED_RESPONSE_IO_PENDING, 54 AUTH_REQUIRED_RESPONSE_IO_PENDING,
55 }; 55 };
56 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; 56 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback;
57 57
58 // URLBlacklistState indicates if the URL was defined in blacklist,
Thiemo Nagel 2016/03/08 18:44:35 There's no need to repeat "URLBlacklistState".
59 // in whitelist or is not present in either lists as defined in
60 // URLBlacklist and URLWhitelist policies.
61 enum URLBlacklistState {
Thiemo Nagel 2016/03/08 18:44:35 Why do you need a tri-state? Please explain in CL
62 URL_IN_WHITELIST,
63 URL_IN_BLACKLIST,
64 URL_NEUTRAL_STATE,
65 };
66
58 virtual ~NetworkDelegate() {} 67 virtual ~NetworkDelegate() {}
59 68
60 // Notification interface called by the network stack. Note that these 69 // Notification interface called by the network stack. Note that these
61 // functions mostly forward to the private virtuals. They also add some sanity 70 // functions mostly forward to the private virtuals. They also add some sanity
62 // checking on parameters. See the corresponding virtuals for explanations of 71 // checking on parameters. See the corresponding virtuals for explanations of
63 // the methods and their arguments. 72 // the methods and their arguments.
64 int NotifyBeforeURLRequest(URLRequest* request, 73 int NotifyBeforeURLRequest(URLRequest* request,
65 const CompletionCallback& callback, 74 const CompletionCallback& callback,
66 GURL* new_url); 75 GURL* new_url);
67 void NotifyResolveProxy(const GURL& url, 76 void NotifyResolveProxy(const GURL& url,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // https://crbug.com/546820 121 // https://crbug.com/546820
113 bool AreExperimentalCookieFeaturesEnabled() const; 122 bool AreExperimentalCookieFeaturesEnabled() const;
114 // TODO(jww): Remove this once we ship strict secure cookies. 123 // TODO(jww): Remove this once we ship strict secure cookies.
115 bool AreStrictSecureCookiesEnabled() const; 124 bool AreStrictSecureCookiesEnabled() const;
116 125
117 bool CancelURLRequestWithPolicyViolatingReferrerHeader( 126 bool CancelURLRequestWithPolicyViolatingReferrerHeader(
118 const URLRequest& request, 127 const URLRequest& request,
119 const GURL& target_url, 128 const GURL& target_url,
120 const GURL& referrer_url) const; 129 const GURL& referrer_url) const;
121 130
131 // This function is to be used to check if the url is defined in
Thiemo Nagel 2016/03/08 18:44:35 Use pipes to refer to a parameter, such as |url|.
132 // blacklist or whitelist policy.
133 virtual URLBlacklistState GetURLBlacklistState(const GURL& url);
Thiemo Nagel 2016/03/08 18:44:35 Please make the method const.
134
122 private: 135 private:
123 // This is the interface for subclasses of NetworkDelegate to implement. These 136 // This is the interface for subclasses of NetworkDelegate to implement. These
124 // member functions will be called by the respective public notification 137 // member functions will be called by the respective public notification
125 // member function, which will perform basic sanity checking. 138 // member function, which will perform basic sanity checking.
126 139
127 // Called before a request is sent. Allows the delegate to rewrite the URL 140 // Called before a request is sent. Allows the delegate to rewrite the URL
128 // being fetched by modifying |new_url|. If set, the URL must be valid. The 141 // being fetched by modifying |new_url|. If set, the URL must be valid. The
129 // reference fragment from the original URL is not automatically appended to 142 // reference fragment from the original URL is not automatically appended to
130 // |new_url|; callers are responsible for copying the reference fragment if 143 // |new_url|; callers are responsible for copying the reference fragment if
131 // desired. 144 // desired.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // header is stripped from the request. 323 // header is stripped from the request.
311 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 324 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
312 const URLRequest& request, 325 const URLRequest& request,
313 const GURL& target_url, 326 const GURL& target_url,
314 const GURL& referrer_url) const = 0; 327 const GURL& referrer_url) const = 0;
315 }; 328 };
316 329
317 } // namespace net 330 } // namespace net
318 331
319 #endif // NET_BASE_NETWORK_DELEGATE_H_ 332 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698