| 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_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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // ContinueDespiteLastError(). cert_error is a ERR_* error code | 267 // ContinueDespiteLastError(). cert_error is a ERR_* error code |
| 268 // indicating what's wrong with the certificate. | 268 // indicating what's wrong with the certificate. |
| 269 // If |fatal| is true then the host in question demands a higher level | 269 // If |fatal| is true then the host in question demands a higher level |
| 270 // of security (due e.g. to HTTP Strict Transport Security, user | 270 // of security (due e.g. to HTTP Strict Transport Security, user |
| 271 // preference, or built-in policy). In this case, errors must not be | 271 // preference, or built-in policy). In this case, errors must not be |
| 272 // bypassable by the user. | 272 // bypassable by the user. |
| 273 virtual void OnSSLCertificateError(URLRequest* request, | 273 virtual void OnSSLCertificateError(URLRequest* request, |
| 274 const SSLInfo& ssl_info, | 274 const SSLInfo& ssl_info, |
| 275 bool fatal); | 275 bool fatal); |
| 276 | 276 |
| 277 // Called to notify that the request must use the network to complete the |
| 278 // request and is about to do so. This is called at most once per |
| 279 // URLRequest, and by default does not defer. If deferred, call |
| 280 // ResumeNetworkStart() to continue or Cancel() to cancel. |
| 281 virtual void OnBeforeNetworkStart(URLRequest* request, bool* defer); |
| 282 |
| 277 // After calling Start(), the delegate will receive an OnResponseStarted | 283 // After calling Start(), the delegate will receive an OnResponseStarted |
| 278 // callback when the request has completed. If an error occurred, the | 284 // callback when the request has completed. If an error occurred, the |
| 279 // request->status() will be set. On success, all redirects have been | 285 // request->status() will be set. On success, all redirects have been |
| 280 // followed and the final response is beginning to arrive. At this point, | 286 // followed and the final response is beginning to arrive. At this point, |
| 281 // meta data about the response is available, including for example HTTP | 287 // meta data about the response is available, including for example HTTP |
| 282 // response headers if this is a request for a HTTP resource. | 288 // response headers if this is a request for a HTTP resource. |
| 283 virtual void OnResponseStarted(URLRequest* request) = 0; | 289 virtual void OnResponseStarted(URLRequest* request) = 0; |
| 284 | 290 |
| 285 // Called when the a Read of the response body is completed after an | 291 // Called when the a Read of the response body is completed after an |
| 286 // IO_PENDING status from a Read() call. | 292 // IO_PENDING status from a Read() call. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // Note that this method has no effect on other (simultaneous or not) requests | 621 // Note that this method has no effect on other (simultaneous or not) requests |
| 616 // for the same resource. The typical example is a request that results in | 622 // for the same resource. The typical example is a request that results in |
| 617 // the data being stored to disk (downloaded instead of rendered) so we don't | 623 // the data being stored to disk (downloaded instead of rendered) so we don't |
| 618 // want to store it twice. | 624 // want to store it twice. |
| 619 void StopCaching(); | 625 void StopCaching(); |
| 620 | 626 |
| 621 // This method may be called to follow a redirect that was deferred in | 627 // This method may be called to follow a redirect that was deferred in |
| 622 // response to an OnReceivedRedirect call. | 628 // response to an OnReceivedRedirect call. |
| 623 void FollowDeferredRedirect(); | 629 void FollowDeferredRedirect(); |
| 624 | 630 |
| 631 // This method must be called to resume network communications that were |
| 632 // deferred in response to an OnBeforeNetworkStart call. |
| 633 void ResumeNetworkStart(); |
| 634 |
| 625 // One of the following two methods should be called in response to an | 635 // One of the following two methods should be called in response to an |
| 626 // OnAuthRequired() callback (and only then). | 636 // OnAuthRequired() callback (and only then). |
| 627 // SetAuth will reissue the request with the given credentials. | 637 // SetAuth will reissue the request with the given credentials. |
| 628 // CancelAuth will give up and display the error page. | 638 // CancelAuth will give up and display the error page. |
| 629 void SetAuth(const AuthCredentials& credentials); | 639 void SetAuth(const AuthCredentials& credentials); |
| 630 void CancelAuth(); | 640 void CancelAuth(); |
| 631 | 641 |
| 632 // This method can be called after the user selects a client certificate to | 642 // This method can be called after the user selects a client certificate to |
| 633 // instruct this URLRequest to continue with the request with the | 643 // instruct this URLRequest to continue with the request with the |
| 634 // certificate. Pass NULL if the user doesn't have a client certificate. | 644 // certificate. Pass NULL if the user doesn't have a client certificate. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // Allow the URLRequestJob class to set our status too | 692 // Allow the URLRequestJob class to set our status too |
| 683 void set_status(const URLRequestStatus& value) { status_ = value; } | 693 void set_status(const URLRequestStatus& value) { status_ = value; } |
| 684 | 694 |
| 685 // Allow the URLRequestJob to redirect this request. Returns OK if | 695 // Allow the URLRequestJob to redirect this request. Returns OK if |
| 686 // successful, otherwise an error code is returned. | 696 // successful, otherwise an error code is returned. |
| 687 int Redirect(const GURL& location, int http_status_code); | 697 int Redirect(const GURL& location, int http_status_code); |
| 688 | 698 |
| 689 // Called by URLRequestJob to allow interception when a redirect occurs. | 699 // Called by URLRequestJob to allow interception when a redirect occurs. |
| 690 void NotifyReceivedRedirect(const GURL& location, bool* defer_redirect); | 700 void NotifyReceivedRedirect(const GURL& location, bool* defer_redirect); |
| 691 | 701 |
| 702 // Called by URLRequestHttpJob (note, only HTTP(S) jobs will call this) to |
| 703 // allow deferral of network initialization. |
| 704 void NotifyBeforeNetworkStart(bool* defer); |
| 705 |
| 692 // Allow an interceptor's URLRequestJob to restart this request. | 706 // Allow an interceptor's URLRequestJob to restart this request. |
| 693 // Should only be called if the original job has not started a response. | 707 // Should only be called if the original job has not started a response. |
| 694 void Restart(); | 708 void Restart(); |
| 695 | 709 |
| 696 private: | 710 private: |
| 697 friend class URLRequestJob; | 711 friend class URLRequestJob; |
| 712 friend class URLRequestHttpJob; |
| 698 | 713 |
| 699 // Registers a new protocol handler for the given scheme. If the scheme is | 714 // Registers a new protocol handler for the given scheme. If the scheme is |
| 700 // already handled, this will overwrite the given factory. To delete the | 715 // already handled, this will overwrite the given factory. To delete the |
| 701 // protocol factory, use NULL for the factory BUT this WILL NOT put back | 716 // protocol factory, use NULL for the factory BUT this WILL NOT put back |
| 702 // any previously registered protocol factory. It will have returned | 717 // any previously registered protocol factory. It will have returned |
| 703 // the previously registered factory (or NULL if none is registered) when | 718 // the previously registered factory (or NULL if none is registered) when |
| 704 // the scheme was first registered so that the caller can manually put it | 719 // the scheme was first registered so that the caller can manually put it |
| 705 // back if desired. | 720 // back if desired. |
| 706 // | 721 // |
| 707 // The scheme must be all-lowercase ASCII. See the ProtocolFactory | 722 // The scheme must be all-lowercase ASCII. See the ProtocolFactory |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 int64 received_response_content_length_; | 887 int64 received_response_content_length_; |
| 873 | 888 |
| 874 base::TimeTicks creation_time_; | 889 base::TimeTicks creation_time_; |
| 875 | 890 |
| 876 // Timing information for the most recent request. Its start times are | 891 // Timing information for the most recent request. Its start times are |
| 877 // populated during Start(), and the rest are populated in OnResponseReceived. | 892 // populated during Start(), and the rest are populated in OnResponseReceived. |
| 878 LoadTimingInfo load_timing_info_; | 893 LoadTimingInfo load_timing_info_; |
| 879 | 894 |
| 880 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 895 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
| 881 | 896 |
| 897 // Keeps track of whether or not OnNetworkCreateStream has been called yet. |
| 898 bool notified_before_network_start_; |
| 899 |
| 882 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 900 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 883 }; | 901 }; |
| 884 | 902 |
| 885 } // namespace net | 903 } // namespace net |
| 886 | 904 |
| 887 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 905 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |