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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const CompletionCallback& callback, | 61 const CompletionCallback& callback, |
62 GURL* new_url); | 62 GURL* new_url); |
63 int NotifyBeforeSendHeaders(URLRequest* request, | 63 int NotifyBeforeSendHeaders(URLRequest* request, |
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 GURL* new_url, |
71 const HttpResponseHeaders* original_response_headers, | 72 const HttpResponseHeaders* original_response_headers, |
72 scoped_refptr<HttpResponseHeaders>* override_response_headers); | 73 scoped_refptr<HttpResponseHeaders>* override_response_headers); |
73 void NotifyBeforeRedirect(URLRequest* request, | 74 void NotifyBeforeRedirect(URLRequest* request, |
74 const GURL& new_location); | 75 const GURL& new_location); |
75 void NotifyResponseStarted(URLRequest* request); | 76 void NotifyResponseStarted(URLRequest* request); |
76 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); | 77 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); |
77 void NotifyCompleted(URLRequest* request, bool started); | 78 void NotifyCompleted(URLRequest* request, bool started); |
78 void NotifyURLRequestDestroyed(URLRequest* request); | 79 void NotifyURLRequestDestroyed(URLRequest* request); |
79 void NotifyPACScriptError(int line_number, const base::string16& error); | 80 void NotifyPACScriptError(int line_number, const base::string16& error); |
80 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 81 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const CompletionCallback& callback, | 123 const CompletionCallback& callback, |
123 HttpRequestHeaders* headers); | 124 HttpRequestHeaders* headers); |
124 | 125 |
125 // Called right before the HTTP request(s) are being sent to the network. | 126 // Called right before the HTTP request(s) are being sent to the network. |
126 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is | 127 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is |
127 // called for this request. | 128 // called for this request. |
128 virtual void OnSendHeaders(URLRequest* request, | 129 virtual void OnSendHeaders(URLRequest* request, |
129 const HttpRequestHeaders& headers); | 130 const HttpRequestHeaders& headers); |
130 | 131 |
131 // Called for HTTP requests when the headers have been received. | 132 // Called for HTTP requests when the headers have been received. |
| 133 // Allows delegate to rewrite the URL being fetched by modifying |new_url|. |
132 // |original_response_headers| contains the headers as received over the | 134 // |original_response_headers| contains the headers as received over the |
133 // network, these must not be modified. |override_response_headers| can be set | 135 // network, these must not be modified. |override_response_headers| can be set |
134 // to new values, that should be considered as overriding | 136 // to new values, that should be considered as overriding |
135 // |original_response_headers|. | 137 // |original_response_headers|. |
136 // |callback|, |original_response_headers|, and |override_response_headers| | 138 // |callback|, |original_response_headers|, and |override_response_headers| |
137 // are only valid until OnURLRequestDestroyed is called for this request. | 139 // are only valid until OnURLRequestDestroyed is called for this request. |
138 // See OnBeforeURLRequest for return value description. Returns OK by default. | 140 // See OnBeforeURLRequest for return value description. Returns OK by default. |
139 virtual int OnHeadersReceived( | 141 virtual int OnHeadersReceived( |
140 URLRequest* request, | 142 URLRequest* request, |
141 const CompletionCallback& callback, | 143 const CompletionCallback& callback, |
| 144 GURL* new_url, |
142 const HttpResponseHeaders* original_response_headers, | 145 const HttpResponseHeaders* original_response_headers, |
143 scoped_refptr<HttpResponseHeaders>* override_response_headers); | 146 scoped_refptr<HttpResponseHeaders>* override_response_headers); |
144 | 147 |
145 // Called right after a redirect response code was received. | 148 // Called right after a redirect response code was received. |
146 // |new_location| is only valid until OnURLRequestDestroyed is called for this | 149 // |new_location| is only valid until OnURLRequestDestroyed is called for this |
147 // request. | 150 // request. |
148 virtual void OnBeforeRedirect(URLRequest* request, | 151 virtual void OnBeforeRedirect(URLRequest* request, |
149 const GURL& new_location); | 152 const GURL& new_location); |
150 | 153 |
151 // This corresponds to URLRequestDelegate::OnResponseStarted. | 154 // This corresponds to URLRequestDelegate::OnResponseStarted. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 227 |
225 // Called before a SocketStream tries to connect. | 228 // Called before a SocketStream tries to connect. |
226 // See OnBeforeURLRequest for return value description. Returns OK by default. | 229 // See OnBeforeURLRequest for return value description. Returns OK by default. |
227 virtual int OnBeforeSocketStreamConnect( | 230 virtual int OnBeforeSocketStreamConnect( |
228 SocketStream* socket, const CompletionCallback& callback); | 231 SocketStream* socket, const CompletionCallback& callback); |
229 }; | 232 }; |
230 | 233 |
231 } // namespace net | 234 } // namespace net |
232 | 235 |
233 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 236 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |