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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const AuthChallengeInfo& auth_info, | 78 const AuthChallengeInfo& auth_info, |
79 const AuthCallback& callback, | 79 const AuthCallback& callback, |
80 AuthCredentials* credentials); | 80 AuthCredentials* credentials); |
81 bool CanGetCookies(const URLRequest& request, | 81 bool CanGetCookies(const URLRequest& request, |
82 const CookieList& cookie_list); | 82 const CookieList& cookie_list); |
83 bool CanSetCookie(const URLRequest& request, | 83 bool CanSetCookie(const URLRequest& request, |
84 const std::string& cookie_line, | 84 const std::string& cookie_line, |
85 CookieOptions* options); | 85 CookieOptions* options); |
86 bool CanAccessFile(const URLRequest& request, | 86 bool CanAccessFile(const URLRequest& request, |
87 const FilePath& path) const; | 87 const FilePath& path) const; |
| 88 bool CanThrottleRequest(const URLRequest& request) const; |
88 | 89 |
89 private: | 90 private: |
90 // This is the interface for subclasses of NetworkDelegate to implement. These | 91 // This is the interface for subclasses of NetworkDelegate to implement. These |
91 // member functions will be called by the respective public notification | 92 // member functions will be called by the respective public notification |
92 // member function, which will perform basic sanity checking. | 93 // member function, which will perform basic sanity checking. |
93 | 94 |
94 // Called before a request is sent. Allows the delegate to rewrite the URL | 95 // Called before a request is sent. Allows the delegate to rewrite the URL |
95 // being fetched by modifying |new_url|. |callback| and |new_url| are valid | 96 // being fetched by modifying |new_url|. |callback| and |new_url| are valid |
96 // only until OnURLRequestDestroyed is called for this request. Returns a net | 97 // only until OnURLRequestDestroyed is called for this request. Returns a net |
97 // status code, generally either OK to continue with the request or | 98 // status code, generally either OK to continue with the request or |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 const std::string& cookie_line, | 196 const std::string& cookie_line, |
196 CookieOptions* options) = 0; | 197 CookieOptions* options) = 0; |
197 | 198 |
198 | 199 |
199 // Called when a file access is attempted to allow the network delegate to | 200 // Called when a file access is attempted to allow the network delegate to |
200 // allow or block access to the given file path. Returns true if access is | 201 // allow or block access to the given file path. Returns true if access is |
201 // allowed. | 202 // allowed. |
202 virtual bool OnCanAccessFile(const URLRequest& request, | 203 virtual bool OnCanAccessFile(const URLRequest& request, |
203 const FilePath& path) const = 0; | 204 const FilePath& path) const = 0; |
204 | 205 |
| 206 // Returns true if the given request may be rejected when the |
| 207 // URLRequestThrottlerManager believes the server servicing the |
| 208 // request is overloaded or down. |
| 209 virtual bool OnCanThrottleRequest(const URLRequest& request) const = 0; |
205 }; | 210 }; |
206 | 211 |
207 } // namespace net | 212 } // namespace net |
208 | 213 |
209 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 214 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |