Chromium Code Reviews| Index: net/url_request/url_request.h |
| =================================================================== |
| --- net/url_request/url_request.h (revision 21335) |
| +++ net/url_request/url_request.h (working copy) |
| @@ -135,10 +135,18 @@ |
| // |
| // When this function is called, the request will still contain the |
| // original URL, the destination of the redirect is provided in 'new_url'. |
| - // If the request is not canceled the redirect will be followed and the |
| - // request's URL will be changed to the new URL. |
| + // If the delegate does not cancel the request and |*defer_redirect| is |
| + // false, then the redirect will be followed, and the request's URL will be |
| + // changed to the new URL. Otherwise if the delegate does not cancel the |
| + // request and |*defer_redirect| is true, then the redirect will be |
| + // followed once FollowDeferredRedirect is called on the URLRequest. |
| + // |
| + // The default value for |*defer_redirect| is false, so that consumers do |
|
wtc
2009/07/23 00:30:12
I suggest rewriting this sentence as follows:
T
darin (slow to review)
2009/07/23 01:27:29
Done.
wtc
2009/07/23 02:37:48
I agree.
|
| + // not need to set it if they are happy with the default behavior. |
| virtual void OnReceivedRedirect(URLRequest* request, |
| - const GURL& new_url) = 0; |
| + const GURL& new_url, |
| + bool* defer_redirect) { |
| + } |
| // Called when we receive an authentication failure. The delegate should |
| // call request->SetAuth() with the user's credentials once it obtains them, |
| @@ -436,6 +444,10 @@ |
| // will be set to an error. |
| bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read); |
| + // This method may be called to follow a redirect that was deferred in |
| + // response to an OnReceivedRedirect call. |
| + void FollowDeferredRedirect(); |
| + |
| // One of the following two methods should be called in response to an |
| // OnAuthRequired() callback (and only then). |
| // SetAuth will reissue the request with the given credentials. |
| @@ -494,7 +506,7 @@ |
| int Redirect(const GURL& location, int http_status_code); |
| // Called by URLRequestJob to allow interception when a redirect occurs. |
| - void ReceivedRedirect(const GURL& location); |
| + void ReceivedRedirect(const GURL& location, bool* defer_redirect); |
| // Called by URLRequestJob to allow interception when the final response |
| // occurs. |