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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const CompletionCallback& callback, | 64 const CompletionCallback& callback, |
65 HttpRequestHeaders* headers); | 65 HttpRequestHeaders* headers); |
66 void NotifySendHeaders(URLRequest* request, | 66 void NotifySendHeaders(URLRequest* request, |
67 const HttpRequestHeaders& headers); | 67 const HttpRequestHeaders& headers); |
68 int NotifyHeadersReceived( | 68 int NotifyHeadersReceived( |
69 URLRequest* request, | 69 URLRequest* request, |
70 const CompletionCallback& callback, | 70 const CompletionCallback& callback, |
71 const HttpResponseHeaders* original_response_headers, | 71 const HttpResponseHeaders* original_response_headers, |
72 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 72 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
73 GURL* allowed_unsafe_redirect_url); | 73 GURL* allowed_unsafe_redirect_url); |
74 void NotifyBeforeRedirect(URLRequest* request, | 74 void NotifyBeforeRedirect(URLRequest* request, const GURL& new_location); |
75 const GURL& new_location); | |
76 void NotifyResponseStarted(URLRequest* request); | 75 void NotifyResponseStarted(URLRequest* request); |
77 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); | 76 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); |
78 void NotifyCompleted(URLRequest* request, bool started); | 77 void NotifyCompleted(URLRequest* request, bool started); |
79 void NotifyURLRequestDestroyed(URLRequest* request); | 78 void NotifyURLRequestDestroyed(URLRequest* request); |
80 void NotifyPACScriptError(int line_number, const base::string16& error); | 79 void NotifyPACScriptError(int line_number, const base::string16& error); |
81 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 80 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, |
82 const AuthChallengeInfo& auth_info, | 81 const AuthChallengeInfo& auth_info, |
83 const AuthCallback& callback, | 82 const AuthCallback& callback, |
84 AuthCredentials* credentials); | 83 AuthCredentials* credentials); |
85 bool CanGetCookies(const URLRequest& request, | 84 bool CanGetCookies(const URLRequest& request, const CookieList& cookie_list); |
86 const CookieList& cookie_list); | |
87 bool CanSetCookie(const URLRequest& request, | 85 bool CanSetCookie(const URLRequest& request, |
88 const std::string& cookie_line, | 86 const std::string& cookie_line, |
89 CookieOptions* options); | 87 CookieOptions* options); |
90 bool CanAccessFile(const URLRequest& request, | 88 bool CanAccessFile(const URLRequest& request, |
91 const base::FilePath& path) const; | 89 const base::FilePath& path) const; |
92 bool CanThrottleRequest(const URLRequest& request) const; | 90 bool CanThrottleRequest(const URLRequest& request) const; |
93 bool CanEnablePrivacyMode(const GURL& url, | 91 bool CanEnablePrivacyMode(const GURL& url, |
94 const GURL& first_party_for_cookies) const; | 92 const GURL& first_party_for_cookies) const; |
95 | 93 |
96 int NotifyBeforeSocketStreamConnect(SocketStream* socket, | 94 int NotifyBeforeSocketStreamConnect(SocketStream* socket, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 virtual int OnHeadersReceived( | 146 virtual int OnHeadersReceived( |
149 URLRequest* request, | 147 URLRequest* request, |
150 const CompletionCallback& callback, | 148 const CompletionCallback& callback, |
151 const HttpResponseHeaders* original_response_headers, | 149 const HttpResponseHeaders* original_response_headers, |
152 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 150 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
153 GURL* allowed_unsafe_redirect_url); | 151 GURL* allowed_unsafe_redirect_url); |
154 | 152 |
155 // Called right after a redirect response code was received. | 153 // Called right after a redirect response code was received. |
156 // |new_location| is only valid until OnURLRequestDestroyed is called for this | 154 // |new_location| is only valid until OnURLRequestDestroyed is called for this |
157 // request. | 155 // request. |
158 virtual void OnBeforeRedirect(URLRequest* request, | 156 virtual void OnBeforeRedirect(URLRequest* request, const GURL& new_location); |
159 const GURL& new_location); | |
160 | 157 |
161 // This corresponds to URLRequestDelegate::OnResponseStarted. | 158 // This corresponds to URLRequestDelegate::OnResponseStarted. |
162 virtual void OnResponseStarted(URLRequest* request); | 159 virtual void OnResponseStarted(URLRequest* request); |
163 | 160 |
164 // Called every time we read raw bytes. | 161 // Called every time we read raw bytes. |
165 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read); | 162 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read); |
166 | 163 |
167 // Indicates that the URL request has been completed or failed. | 164 // Indicates that the URL request has been completed or failed. |
168 // |started| indicates whether the request has been started. If false, | 165 // |started| indicates whether the request has been started. If false, |
169 // some information like the socket address is not available. | 166 // some information like the socket address is not available. |
170 virtual void OnCompleted(URLRequest* request, bool started); | 167 virtual void OnCompleted(URLRequest* request, bool started); |
171 | 168 |
172 // Called when an URLRequest is being destroyed. Note that the request is | 169 // Called when an URLRequest is being destroyed. Note that the request is |
173 // being deleted, so it's not safe to call any methods that may result in | 170 // being deleted, so it's not safe to call any methods that may result in |
174 // a virtual method call. | 171 // a virtual method call. |
175 virtual void OnURLRequestDestroyed(URLRequest* request); | 172 virtual void OnURLRequestDestroyed(URLRequest* request); |
176 | 173 |
177 // Corresponds to ProxyResolverJSBindings::OnError. | 174 // Corresponds to ProxyResolverJSBindings::OnError. |
178 virtual void OnPACScriptError(int line_number, | 175 virtual void OnPACScriptError(int line_number, const base::string16& error); |
179 const base::string16& error); | |
180 | 176 |
181 // Called when a request receives an authentication challenge | 177 // Called when a request receives an authentication challenge |
182 // specified by |auth_info|, and is unable to respond using cached | 178 // specified by |auth_info|, and is unable to respond using cached |
183 // credentials. |callback| and |credentials| must be non-NULL, and must | 179 // credentials. |callback| and |credentials| must be non-NULL, and must |
184 // be valid until OnURLRequestDestroyed is called for |request|. | 180 // be valid until OnURLRequestDestroyed is called for |request|. |
185 // | 181 // |
186 // The following return values are allowed: | 182 // The following return values are allowed: |
187 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but | 183 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but |
188 // no action is being taken on it. | 184 // no action is being taken on it. |
189 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with | 185 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 223 |
228 // Returns true if the given |url| has to be requested over connection that | 224 // Returns true if the given |url| has to be requested over connection that |
229 // is not tracked by the server. Usually is false, unless user privacy | 225 // is not tracked by the server. Usually is false, unless user privacy |
230 // settings block cookies from being get or set. | 226 // settings block cookies from being get or set. |
231 virtual bool OnCanEnablePrivacyMode( | 227 virtual bool OnCanEnablePrivacyMode( |
232 const GURL& url, | 228 const GURL& url, |
233 const GURL& first_party_for_cookies) const; | 229 const GURL& first_party_for_cookies) const; |
234 | 230 |
235 // Called before a SocketStream tries to connect. | 231 // Called before a SocketStream tries to connect. |
236 // See OnBeforeURLRequest for return value description. Returns OK by default. | 232 // See OnBeforeURLRequest for return value description. Returns OK by default. |
237 virtual int OnBeforeSocketStreamConnect( | 233 virtual int OnBeforeSocketStreamConnect(SocketStream* socket, |
238 SocketStream* socket, const CompletionCallback& callback); | 234 const CompletionCallback& callback); |
239 }; | 235 }; |
240 | 236 |
241 } // namespace net | 237 } // namespace net |
242 | 238 |
243 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 239 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |