| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "net/base/auth.h" |
| 13 #include "base/debug/leak_tracker.h" | 14 #include "base/debug/leak_tracker.h" |
| 14 #include "base/linked_ptr.h" | 15 #include "base/linked_ptr.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 17 #include "base/string16.h" | 18 #include "base/string16.h" |
| 18 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 20 #include "net/base/load_states.h" | 21 #include "net/base/load_states.h" |
| 21 #include "net/base/net_log.h" | 22 #include "net/base/net_log.h" |
| 22 #include "net/base/request_priority.h" | 23 #include "net/base/request_priority.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // The delegate's methods are called from the message loop of the thread | 116 // The delegate's methods are called from the message loop of the thread |
| 116 // on which the request's Start() method is called. See above for the | 117 // on which the request's Start() method is called. See above for the |
| 117 // ordering of callbacks. | 118 // ordering of callbacks. |
| 118 // | 119 // |
| 119 // The callbacks will be called in the following order: | 120 // The callbacks will be called in the following order: |
| 120 // Start() | 121 // Start() |
| 121 // - OnCertificateRequested* (zero or one call, if the SSL server | 122 // - OnCertificateRequested* (zero or one call, if the SSL server |
| 122 // requests a client certificate for authentication) | 123 // requests a client certificate for authentication) |
| 123 // - OnSSLCertificateError* (zero or one call, if the SSL server's | 124 // - OnSSLCertificateError* (zero or one call, if the SSL server's |
| 124 // certificate has an error) | 125 // certificate has an error) |
| 126 // - OnSSLAuthRequired* (zero or one call, if the SSL server requests |
| 127 // client login credentials for authentication) |
| 125 // - OnReceivedRedirect* (zero or more calls, for the number of redirects) | 128 // - OnReceivedRedirect* (zero or more calls, for the number of redirects) |
| 126 // - OnAuthRequired* (zero or more calls, for the number of | 129 // - OnAuthRequired* (zero or more calls, for the number of |
| 127 // authentication failures) | 130 // authentication failures) |
| 128 // - OnResponseStarted | 131 // - OnResponseStarted |
| 129 // Read() initiated by delegate | 132 // Read() initiated by delegate |
| 130 // - OnReadCompleted* (zero or more calls until all data is read) | 133 // - OnReadCompleted* (zero or more calls until all data is read) |
| 131 // | 134 // |
| 132 // Read() must be called at least once. Read() returns true when it completed | 135 // Read() must be called at least once. Read() returns true when it completed |
| 133 // immediately, and false if an IO is pending or if there is an error. When | 136 // immediately, and false if an IO is pending or if there is an error. When |
| 134 // Read() returns false, the caller can check the Request's status() to see | 137 // Read() returns false, the caller can check the Request's status() to see |
| (...skipping 25 matching lines...) Expand all Loading... |
| 160 bool* defer_redirect); | 163 bool* defer_redirect); |
| 161 | 164 |
| 162 // Called when we receive an authentication failure. The delegate should | 165 // Called when we receive an authentication failure. The delegate should |
| 163 // call request->SetAuth() with the user's credentials once it obtains them, | 166 // call request->SetAuth() with the user's credentials once it obtains them, |
| 164 // or request->CancelAuth() to cancel the login and display the error page. | 167 // or request->CancelAuth() to cancel the login and display the error page. |
| 165 // When it does so, the request will be reissued, restarting the sequence | 168 // When it does so, the request will be reissued, restarting the sequence |
| 166 // of On* callbacks. | 169 // of On* callbacks. |
| 167 virtual void OnAuthRequired(URLRequest* request, | 170 virtual void OnAuthRequired(URLRequest* request, |
| 168 net::AuthChallengeInfo* auth_info); | 171 net::AuthChallengeInfo* auth_info); |
| 169 | 172 |
| 173 // Called when we need to provide TLS client login credentials. |
| 174 virtual void OnTLSLoginRequired(URLRequest* request, |
| 175 net::AuthChallengeInfo* login_request_info); |
| 176 |
| 170 // Called when we receive an SSL CertificateRequest message for client | 177 // Called when we receive an SSL CertificateRequest message for client |
| 171 // authentication. The delegate should call | 178 // authentication. The delegate should call |
| 172 // request->ContinueWithCertificate() with the client certificate the user | 179 // request->ContinueWithCertificate() with the client certificate the user |
| 173 // selected, or request->ContinueWithCertificate(NULL) to continue the SSL | 180 // selected, or request->ContinueWithCertificate(NULL) to continue the SSL |
| 174 // handshake without a client certificate. | 181 // handshake without a client certificate. |
| 175 virtual void OnCertificateRequested( | 182 virtual void OnCertificateRequested( |
| 176 URLRequest* request, | 183 URLRequest* request, |
| 177 net::SSLCertRequestInfo* cert_request_info); | 184 net::SSLCertRequestInfo* cert_request_info); |
| 178 | 185 |
| 179 // Called when using SSL and the server responds with a certificate with | 186 // Called when using SSL and the server responds with a certificate with |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // SetAuth will reissue the request with the given credentials. | 526 // SetAuth will reissue the request with the given credentials. |
| 520 // CancelAuth will give up and display the error page. | 527 // CancelAuth will give up and display the error page. |
| 521 void SetAuth(const string16& username, const string16& password); | 528 void SetAuth(const string16& username, const string16& password); |
| 522 void CancelAuth(); | 529 void CancelAuth(); |
| 523 | 530 |
| 524 // This method can be called after the user selects a client certificate to | 531 // This method can be called after the user selects a client certificate to |
| 525 // instruct this URLRequest to continue with the request with the | 532 // instruct this URLRequest to continue with the request with the |
| 526 // certificate. Pass NULL if the user doesn't have a client certificate. | 533 // certificate. Pass NULL if the user doesn't have a client certificate. |
| 527 void ContinueWithCertificate(net::X509Certificate* client_cert); | 534 void ContinueWithCertificate(net::X509Certificate* client_cert); |
| 528 | 535 |
| 536 // One of the following two methods should be called in response to an |
| 537 // OnTLSLoginRequired() callback. |
| 538 void CancelTLSLogin(); |
| 539 void SetTLSLogin(const string16& username, |
| 540 const string16& password); |
| 541 AuthData* GetTLSLoginAuthData(); |
| 542 |
| 543 void ContinueWithTLSLogin(); |
| 544 |
| 529 // This method can be called after some error notifications to instruct this | 545 // This method can be called after some error notifications to instruct this |
| 530 // URLRequest to ignore the current error and continue with the request. To | 546 // URLRequest to ignore the current error and continue with the request. To |
| 531 // cancel the request instead, call Cancel(). | 547 // cancel the request instead, call Cancel(). |
| 532 void ContinueDespiteLastError(); | 548 void ContinueDespiteLastError(); |
| 533 | 549 |
| 534 // Returns true if performance profiling should be enabled on the | 550 // Returns true if performance profiling should be enabled on the |
| 535 // URLRequestJob serving this request. | 551 // URLRequestJob serving this request. |
| 536 bool enable_profiling() const { return enable_profiling_; } | 552 bool enable_profiling() const { return enable_profiling_; } |
| 537 | 553 |
| 538 void set_enable_profiling(bool profiling) { enable_profiling_ = profiling; } | 554 void set_enable_profiling(bool profiling) { enable_profiling_ = profiling; } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 int redirect_limit_; | 661 int redirect_limit_; |
| 646 | 662 |
| 647 // Cached value for use after we've orphaned the job handling the | 663 // Cached value for use after we've orphaned the job handling the |
| 648 // first transaction in a request involving redirects. | 664 // first transaction in a request involving redirects. |
| 649 uint64 final_upload_progress_; | 665 uint64 final_upload_progress_; |
| 650 | 666 |
| 651 // The priority level for this request. Objects like ClientSocketPool use | 667 // The priority level for this request. Objects like ClientSocketPool use |
| 652 // this to determine which URLRequest to allocate sockets to first. | 668 // this to determine which URLRequest to allocate sockets to first. |
| 653 net::RequestPriority priority_; | 669 net::RequestPriority priority_; |
| 654 | 670 |
| 671 // TLS login data. |
| 672 scoped_refptr<net::AuthData> tls_login_auth_data_; |
| 673 |
| 655 base::debug::LeakTracker<URLRequest> leak_tracker_; | 674 base::debug::LeakTracker<URLRequest> leak_tracker_; |
| 656 | 675 |
| 657 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 676 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 658 }; | 677 }; |
| 659 | 678 |
| 660 } // namespace net | 679 } // namespace net |
| 661 | 680 |
| 662 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 681 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |