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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 // OnAuthRequired call. It's placed in this file to prevent url_request.h | 46 // OnAuthRequired call. It's placed in this file to prevent url_request.h |
47 // from having to include network_delegate.h. | 47 // from having to include network_delegate.h. |
48 enum AuthRequiredResponse { | 48 enum AuthRequiredResponse { |
49 AUTH_REQUIRED_RESPONSE_NO_ACTION, | 49 AUTH_REQUIRED_RESPONSE_NO_ACTION, |
50 AUTH_REQUIRED_RESPONSE_SET_AUTH, | 50 AUTH_REQUIRED_RESPONSE_SET_AUTH, |
51 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, | 51 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, |
52 AUTH_REQUIRED_RESPONSE_IO_PENDING, | 52 AUTH_REQUIRED_RESPONSE_IO_PENDING, |
53 }; | 53 }; |
54 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; | 54 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; |
55 | 55 |
56 // Indicates if the URL matches a pattern defined in blacklist, in whitelist | |
57 // or doesn't match anything in either lists as defined in URLBlacklist and | |
Andrew T Wilson (Slow)
2016/05/02 09:32:11
nit: either lists -> either list.
igorcov
2016/05/02 13:29:08
Done.
| |
58 // URLWhitelist policies. | |
59 enum URLBlacklistState { | |
60 URL_IN_WHITELIST, | |
61 URL_IN_BLACKLIST, | |
62 URL_NEUTRAL_STATE, | |
63 }; | |
64 | |
56 virtual ~NetworkDelegate() {} | 65 virtual ~NetworkDelegate() {} |
57 | 66 |
58 // Notification interface called by the network stack. Note that these | 67 // Notification interface called by the network stack. Note that these |
59 // functions mostly forward to the private virtuals. They also add some sanity | 68 // functions mostly forward to the private virtuals. They also add some sanity |
60 // checking on parameters. See the corresponding virtuals for explanations of | 69 // checking on parameters. See the corresponding virtuals for explanations of |
61 // the methods and their arguments. | 70 // the methods and their arguments. |
62 int NotifyBeforeURLRequest(URLRequest* request, | 71 int NotifyBeforeURLRequest(URLRequest* request, |
63 const CompletionCallback& callback, | 72 const CompletionCallback& callback, |
64 GURL* new_url); | 73 GURL* new_url); |
65 int NotifyBeforeSendHeaders(URLRequest* request, | 74 int NotifyBeforeSendHeaders(URLRequest* request, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 111 |
103 // TODO(jww): Remove this once we ship strict secure cookies: | 112 // TODO(jww): Remove this once we ship strict secure cookies: |
104 // https://crbug.com/546820 | 113 // https://crbug.com/546820 |
105 bool AreStrictSecureCookiesEnabled() const; | 114 bool AreStrictSecureCookiesEnabled() const; |
106 | 115 |
107 bool CancelURLRequestWithPolicyViolatingReferrerHeader( | 116 bool CancelURLRequestWithPolicyViolatingReferrerHeader( |
108 const URLRequest& request, | 117 const URLRequest& request, |
109 const GURL& target_url, | 118 const GURL& target_url, |
110 const GURL& referrer_url) const; | 119 const GURL& referrer_url) const; |
111 | 120 |
121 // This function is to be used to check if the |url| is defined in | |
122 // blacklist or whitelist policy. | |
123 virtual URLBlacklistState GetURLBlacklistState(const GURL& url) const; | |
124 | |
112 private: | 125 private: |
113 // This is the interface for subclasses of NetworkDelegate to implement. These | 126 // This is the interface for subclasses of NetworkDelegate to implement. These |
114 // member functions will be called by the respective public notification | 127 // member functions will be called by the respective public notification |
115 // member function, which will perform basic sanity checking. | 128 // member function, which will perform basic sanity checking. |
116 | 129 |
117 // Called before a request is sent. Allows the delegate to rewrite the URL | 130 // Called before a request is sent. Allows the delegate to rewrite the URL |
118 // being fetched by modifying |new_url|. If set, the URL must be valid. The | 131 // being fetched by modifying |new_url|. If set, the URL must be valid. The |
119 // reference fragment from the original URL is not automatically appended to | 132 // reference fragment from the original URL is not automatically appended to |
120 // |new_url|; callers are responsible for copying the reference fragment if | 133 // |new_url|; callers are responsible for copying the reference fragment if |
121 // desired. | 134 // desired. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 // header is stripped from the request. | 295 // header is stripped from the request. |
283 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 296 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
284 const URLRequest& request, | 297 const URLRequest& request, |
285 const GURL& target_url, | 298 const GURL& target_url, |
286 const GURL& referrer_url) const = 0; | 299 const GURL& referrer_url) const = 0; |
287 }; | 300 }; |
288 | 301 |
289 } // namespace net | 302 } // namespace net |
290 | 303 |
291 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 304 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |