OLD | NEW |
---|---|
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 Loading... | |
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 // Indicates if the URL was defined in blacklist, in whitelist or is not | |
bartfab (slow)
2016/03/10 13:49:42
Nit: URLs are not "defined" in the blacklist/white
| |
59 // present in either lists as defined in URLBlacklist and URLWhitelist | |
60 // policies. | |
61 enum URLBlacklistState { | |
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 Loading... | |
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 | |
132 // blacklist or whitelist policy. | |
133 virtual URLBlacklistState GetURLBlacklistState(const GURL& url) 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 Loading... | |
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_ |
OLD | NEW |