Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: net/url_request/url_request.h

Issue 171099: Merge r21417 to 172.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_URL_REQUEST_URL_REQUEST_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_
6 #define NET_URL_REQUEST_URL_REQUEST_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 public: 96 public:
97 virtual ~Delegate() {} 97 virtual ~Delegate() {}
98 98
99 // Called upon a server-initiated redirect. The delegate may call the 99 // Called upon a server-initiated redirect. The delegate may call the
100 // request's Cancel method to prevent the redirect from being followed. 100 // request's Cancel method to prevent the redirect from being followed.
101 // Since there may be multiple chained redirects, there may also be more 101 // Since there may be multiple chained redirects, there may also be more
102 // than one redirect call. 102 // than one redirect call.
103 // 103 //
104 // When this function is called, the request will still contain the 104 // When this function is called, the request will still contain the
105 // original URL, the destination of the redirect is provided in 'new_url'. 105 // original URL, the destination of the redirect is provided in 'new_url'.
106 // If the request is not canceled the redirect will be followed and the 106 // If the delegate does not cancel the request and |*defer_redirect| is
107 // request's URL will be changed to the new URL. 107 // false, then the redirect will be followed, and the request's URL will be
108 // changed to the new URL. Otherwise if the delegate does not cancel the
109 // request and |*defer_redirect| is true, then the redirect will be
110 // followed once FollowDeferredRedirect is called on the URLRequest.
111 //
112 // The caller must set |*defer_redirect| to false, so that delegates do not
113 // need to set it if they are happy with the default behavior of not
114 // deferring redirect.
108 virtual void OnReceivedRedirect(URLRequest* request, 115 virtual void OnReceivedRedirect(URLRequest* request,
109 const GURL& new_url) = 0; 116 const GURL& new_url,
117 bool* defer_redirect) {
118 }
110 119
111 // Called when we receive an authentication failure. The delegate should 120 // Called when we receive an authentication failure. The delegate should
112 // call request->SetAuth() with the user's credentials once it obtains them, 121 // call request->SetAuth() with the user's credentials once it obtains them,
113 // or request->CancelAuth() to cancel the login and display the error page. 122 // or request->CancelAuth() to cancel the login and display the error page.
114 // When it does so, the request will be reissued, restarting the sequence 123 // When it does so, the request will be reissued, restarting the sequence
115 // of On* callbacks. 124 // of On* callbacks.
116 virtual void OnAuthRequired(URLRequest* request, 125 virtual void OnAuthRequired(URLRequest* request,
117 net::AuthChallengeInfo* auth_info) { 126 net::AuthChallengeInfo* auth_info) {
118 request->CancelAuth(); 127 request->CancelAuth();
119 } 128 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // The max_bytes parameter is the maximum number of bytes to read. 399 // The max_bytes parameter is the maximum number of bytes to read.
391 // 400 //
392 // The bytes_read parameter is an output parameter containing the 401 // The bytes_read parameter is an output parameter containing the
393 // the number of bytes read. A value of 0 indicates that there is no 402 // the number of bytes read. A value of 0 indicates that there is no
394 // more data available to read from the stream. 403 // more data available to read from the stream.
395 // 404 //
396 // If a read error occurs, Read returns false and the request->status 405 // If a read error occurs, Read returns false and the request->status
397 // will be set to an error. 406 // will be set to an error.
398 bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read); 407 bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read);
399 408
409 // This method may be called to follow a redirect that was deferred in
410 // response to an OnReceivedRedirect call.
411 void FollowDeferredRedirect();
412
400 // One of the following two methods should be called in response to an 413 // One of the following two methods should be called in response to an
401 // OnAuthRequired() callback (and only then). 414 // OnAuthRequired() callback (and only then).
402 // SetAuth will reissue the request with the given credentials. 415 // SetAuth will reissue the request with the given credentials.
403 // CancelAuth will give up and display the error page. 416 // CancelAuth will give up and display the error page.
404 void SetAuth(const std::wstring& username, const std::wstring& password); 417 void SetAuth(const std::wstring& username, const std::wstring& password);
405 void CancelAuth(); 418 void CancelAuth();
406 419
407 // This method can be called after some error notifications to instruct this 420 // This method can be called after some error notifications to instruct this
408 // URLRequest to ignore the current error and continue with the request. To 421 // URLRequest to ignore the current error and continue with the request. To
409 // cancel the request instead, call Cancel(). 422 // cancel the request instead, call Cancel().
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- 551 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count--
539 552
540 #else // disable leak checking in release builds... 553 #else // disable leak checking in release builds...
541 554
542 #define URLREQUEST_COUNT_CTOR() 555 #define URLREQUEST_COUNT_CTOR()
543 #define URLREQUEST_COUNT_DTOR() 556 #define URLREQUEST_COUNT_DTOR()
544 557
545 #endif // #ifndef NDEBUG 558 #endif // #ifndef NDEBUG
546 559
547 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 560 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698