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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 // may only be changed before Start() is called. | 296 // may only be changed before Start() is called. |
297 const std::string& referrer() const { return referrer_; } | 297 const std::string& referrer() const { return referrer_; } |
298 // Referrer is sanitized to remove URL fragment, user name and password. | 298 // Referrer is sanitized to remove URL fragment, user name and password. |
299 void SetReferrer(const std::string& referrer); | 299 void SetReferrer(const std::string& referrer); |
300 | 300 |
301 // The referrer policy to apply when updating the referrer during redirects. | 301 // The referrer policy to apply when updating the referrer during redirects. |
302 // The referrer policy may only be changed before Start() is called. | 302 // The referrer policy may only be changed before Start() is called. |
303 ReferrerPolicy referrer_policy() const { return referrer_policy_; } | 303 ReferrerPolicy referrer_policy() const { return referrer_policy_; } |
304 void set_referrer_policy(ReferrerPolicy referrer_policy); | 304 void set_referrer_policy(ReferrerPolicy referrer_policy); |
305 | 305 |
306 // Sets the delegate of the request. This value may be changed at any time, | 306 // Sets the delegate of the request. This is only to allow creating a request |
307 // and it is permissible for it to be null. | 307 // before creating its delegate. |delegate| must be non-NULL and the request |
308 // must not yet have a Delegate set. | |
308 void set_delegate(Delegate* delegate); | 309 void set_delegate(Delegate* delegate); |
309 | 310 |
310 // Indicates that the request body should be sent using chunked transfer | 311 // Indicates that the request body should be sent using chunked transfer |
311 // encoding. This method may only be called before Start() is called. | 312 // encoding. This method may only be called before Start() is called. |
312 void EnableChunkedUpload(); | 313 void EnableChunkedUpload(); |
313 | 314 |
314 // Appends the given bytes to the request's upload data to be sent | 315 // Appends the given bytes to the request's upload data to be sent |
315 // immediately via chunked transfer encoding. When all data has been added, | 316 // immediately via chunked transfer encoding. When all data has been added, |
316 // set |is_last_chunk| to true to indicate the end of upload data. All chunks | 317 // set |is_last_chunk| to true to indicate the end of upload data. All chunks |
317 // but the last must have |bytes_len| > 0. | 318 // but the last must have |bytes_len| > 0. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 // Returns true if the request is in the process of redirecting to a new | 516 // Returns true if the request is in the process of redirecting to a new |
516 // URL but has not yet initiated the new request. | 517 // URL but has not yet initiated the new request. |
517 bool is_redirecting() const { return is_redirecting_; } | 518 bool is_redirecting() const { return is_redirecting_; } |
518 | 519 |
519 // Returns the error status of the request. | 520 // Returns the error status of the request. |
520 const URLRequestStatus& status() const { return status_; } | 521 const URLRequestStatus& status() const { return status_; } |
521 | 522 |
522 // Returns a globally unique identifier for this request. | 523 // Returns a globally unique identifier for this request. |
523 uint64 identifier() const { return identifier_; } | 524 uint64 identifier() const { return identifier_; } |
524 | 525 |
525 // This method is called to start the request. The delegate will receive | 526 // This method is called to start the request. The Delegate will receive |
526 // a OnResponseStarted callback when the request is started. | 527 // a OnResponseStarted callback when the request is started. The request |
528 // must have a delegate set before this method is called. | |
xunjieli
2015/12/14 20:12:08
nit: maybe s/delegate/Delegate to be consistent wi
mmenke
2015/12/14 20:24:11
I decided to go with "delegate" in both places ins
| |
527 void Start(); | 529 void Start(); |
528 | 530 |
529 // This method may be called at any time after Start() has been called to | 531 // This method may be called at any time after Start() has been called to |
530 // cancel the request. This method may be called many times, and it has | 532 // cancel the request. This method may be called many times, and it has |
531 // no effect once the response has completed. It is guaranteed that no | 533 // no effect once the response has completed. It is guaranteed that no |
532 // methods of the delegate will be called after the request has been | 534 // methods of the delegate will be called after the request has been |
533 // cancelled, except that this may call the delegate's OnReadCompleted() | 535 // cancelled, except that this may call the delegate's OnReadCompleted() |
534 // during the call to Cancel itself. | 536 // during the call to Cancel itself. |
535 void Cancel(); | 537 void Cancel(); |
536 | 538 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 | 616 |
615 // Sets the priority level for this request and any related | 617 // Sets the priority level for this request and any related |
616 // jobs. Must not change the priority to anything other than | 618 // jobs. Must not change the priority to anything other than |
617 // MAXIMUM_PRIORITY if the IGNORE_LIMITS load flag is set. | 619 // MAXIMUM_PRIORITY if the IGNORE_LIMITS load flag is set. |
618 void SetPriority(RequestPriority priority); | 620 void SetPriority(RequestPriority priority); |
619 | 621 |
620 // Returns true iff this request would be internally redirected to HTTPS | 622 // Returns true iff this request would be internally redirected to HTTPS |
621 // due to HSTS. If so, |redirect_url| is rewritten to the new HTTPS URL. | 623 // due to HSTS. If so, |redirect_url| is rewritten to the new HTTPS URL. |
622 bool GetHSTSRedirect(GURL* redirect_url) const; | 624 bool GetHSTSRedirect(GURL* redirect_url) const; |
623 | 625 |
624 // TODO(willchan): Undo this. Only temporarily public. | |
625 bool has_delegate() const { return delegate_ != NULL; } | |
626 | |
627 // NOTE(willchan): This is just temporary for debugging | 626 // NOTE(willchan): This is just temporary for debugging |
628 // http://crbug.com/90971. | 627 // http://crbug.com/90971. |
629 // Allows to setting debug info into the URLRequest. | 628 // Allows to setting debug info into the URLRequest. |
630 void set_stack_trace(const base::debug::StackTrace& stack_trace); | 629 void set_stack_trace(const base::debug::StackTrace& stack_trace); |
631 const base::debug::StackTrace* stack_trace() const; | 630 const base::debug::StackTrace* stack_trace() const; |
632 | 631 |
633 void set_received_response_content_length(int64_t received_content_length) { | 632 void set_received_response_content_length(int64_t received_content_length) { |
634 received_response_content_length_ = received_content_length; | 633 received_response_content_length_ = received_content_length; |
635 } | 634 } |
636 | 635 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 // Notifies the network delegate that the request has been completed. | 719 // Notifies the network delegate that the request has been completed. |
721 // This does not imply a successful completion. Also a canceled request is | 720 // This does not imply a successful completion. Also a canceled request is |
722 // considered completed. | 721 // considered completed. |
723 void NotifyRequestCompleted(); | 722 void NotifyRequestCompleted(); |
724 | 723 |
725 // Called by URLRequestJob to allow interception when the final response | 724 // Called by URLRequestJob to allow interception when the final response |
726 // occurs. | 725 // occurs. |
727 void NotifyResponseStarted(); | 726 void NotifyResponseStarted(); |
728 | 727 |
729 // These functions delegate to |delegate_| and may only be used if | 728 // These functions delegate to |delegate_| and may only be used if |
730 // |delegate_| is not NULL. See URLRequest::Delegate for the meaning | 729 // |delegate_| is not NULL. See URLRequest::Delegate for the meaning |
xunjieli
2015/12/14 20:12:08
I think we probably can get rid of "and may only b
mmenke
2015/12/14 20:24:10
Nice catch, done!
| |
731 // of these functions. | 730 // of these functions. |
732 void NotifyAuthRequired(AuthChallengeInfo* auth_info); | 731 void NotifyAuthRequired(AuthChallengeInfo* auth_info); |
733 void NotifyAuthRequiredComplete(NetworkDelegate::AuthRequiredResponse result); | 732 void NotifyAuthRequiredComplete(NetworkDelegate::AuthRequiredResponse result); |
734 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); | 733 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); |
735 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal); | 734 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal); |
736 void NotifyReadCompleted(int bytes_read); | 735 void NotifyReadCompleted(int bytes_read); |
737 | 736 |
738 // These functions delegate to |network_delegate_| if it is not NULL. | 737 // These functions delegate to |network_delegate_| if it is not NULL. |
739 // If |network_delegate_| is NULL, cookies can be used unless | 738 // If |network_delegate_| is NULL, cookies can be used unless |
740 // SetDefaultCookiePolicyToBlock() has been called. | 739 // SetDefaultCookiePolicyToBlock() has been called. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 HostPortPair proxy_server_; | 861 HostPortPair proxy_server_; |
863 | 862 |
864 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 863 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
865 | 864 |
866 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 865 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
867 }; | 866 }; |
868 | 867 |
869 } // namespace net | 868 } // namespace net |
870 | 869 |
871 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 870 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |