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> |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 // Sets all extra request headers. Any extra request headers set by other | 425 // Sets all extra request headers. Any extra request headers set by other |
426 // methods are overwritten by this method. This method may only be called | 426 // methods are overwritten by this method. This method may only be called |
427 // before Start() is called. It is an error to call it later. | 427 // before Start() is called. It is an error to call it later. |
428 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); | 428 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); |
429 | 429 |
430 const HttpRequestHeaders& extra_request_headers() const { | 430 const HttpRequestHeaders& extra_request_headers() const { |
431 return extra_request_headers_; | 431 return extra_request_headers_; |
432 } | 432 } |
433 | 433 |
434 // Returns the current load state for the request. | 434 // Returns the current load state for the request. |param| is an optional |
435 LoadState GetLoadState() const; | 435 // parameter describing details related to the load state. Not all load states |
| 436 // have a parameter. |
| 437 LoadStateWithParam GetLoadState() const; |
| 438 void SetLoadStateParam(const string16& param) { |
| 439 load_state_param_ = param; |
| 440 } |
436 | 441 |
437 // Returns the current upload progress in bytes. | 442 // Returns the current upload progress in bytes. |
438 uint64 GetUploadProgress() const; | 443 uint64 GetUploadProgress() const; |
439 | 444 |
440 // Get response header(s) by ID or name. These methods may only be called | 445 // Get response header(s) by ID or name. These methods may only be called |
441 // once the delegate's OnResponseStarted method has been called. Headers | 446 // once the delegate's OnResponseStarted method has been called. Headers |
442 // that appear more than once in the response are coalesced, with values | 447 // that appear more than once in the response are coalesced, with values |
443 // separated by commas (per RFC 2616). This will not work with cookies since | 448 // separated by commas (per RFC 2616). This will not work with cookies since |
444 // comma can be used in cookie values. | 449 // comma can be used in cookie values. |
445 // TODO(darin): add API to enumerate response headers. | 450 // TODO(darin): add API to enumerate response headers. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 // |delegate_| is not NULL. See URLRequest::Delegate for the meaning | 713 // |delegate_| is not NULL. See URLRequest::Delegate for the meaning |
709 // of these functions. | 714 // of these functions. |
710 void NotifyAuthRequired(AuthChallengeInfo* auth_info); | 715 void NotifyAuthRequired(AuthChallengeInfo* auth_info); |
711 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); | 716 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); |
712 void NotifySSLCertificateError(int cert_error, X509Certificate* cert); | 717 void NotifySSLCertificateError(int cert_error, X509Certificate* cert); |
713 bool CanGetCookies(const CookieList& cookie_list) const; | 718 bool CanGetCookies(const CookieList& cookie_list) const; |
714 bool CanSetCookie(const std::string& cookie_line, | 719 bool CanSetCookie(const std::string& cookie_line, |
715 CookieOptions* options) const; | 720 CookieOptions* options) const; |
716 void NotifyReadCompleted(int bytes_read); | 721 void NotifyReadCompleted(int bytes_read); |
717 | 722 |
| 723 // Called when the delegate blocks or unblocks this request when intercepting |
| 724 // certain requests. |
| 725 void SetBlockedOnDelegate(); |
| 726 void SetUnblockedOnDelegate(); |
| 727 |
718 // Contextual information used for this request (can be NULL). This contains | 728 // Contextual information used for this request (can be NULL). This contains |
719 // most of the dependencies which are shared between requests (disk cache, | 729 // most of the dependencies which are shared between requests (disk cache, |
720 // cookie store, socket pool, etc.) | 730 // cookie store, socket pool, etc.) |
721 scoped_refptr<const URLRequestContext> context_; | 731 scoped_refptr<const URLRequestContext> context_; |
722 | 732 |
723 // Tracks the time spent in various load states throughout this request. | 733 // Tracks the time spent in various load states throughout this request. |
724 BoundNetLog net_log_; | 734 BoundNetLog net_log_; |
725 | 735 |
726 scoped_refptr<URLRequestJob> job_; | 736 scoped_refptr<URLRequestJob> job_; |
727 scoped_refptr<UploadData> upload_; | 737 scoped_refptr<UploadData> upload_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 778 |
769 // TODO(battre): The only consumer of the identifier_ is currently the | 779 // TODO(battre): The only consumer of the identifier_ is currently the |
770 // web request API. We need to match identifiers of requests between the | 780 // web request API. We need to match identifiers of requests between the |
771 // web request API and the web navigation API. As the URLRequest does not | 781 // web request API and the web navigation API. As the URLRequest does not |
772 // exist when the web navigation API is triggered, the tracking probably | 782 // exist when the web navigation API is triggered, the tracking probably |
773 // needs to be done outside of the URLRequest anyway. Therefore, this | 783 // needs to be done outside of the URLRequest anyway. Therefore, this |
774 // identifier should be deleted here. http://crbug.com/89321 | 784 // identifier should be deleted here. http://crbug.com/89321 |
775 // A globally unique identifier for this request. | 785 // A globally unique identifier for this request. |
776 const uint64 identifier_; | 786 const uint64 identifier_; |
777 | 787 |
| 788 // True if this request is blocked waiting for the network delegate to resume |
| 789 // it. |
| 790 bool blocked_on_delegate_; |
| 791 |
| 792 // An optional parameter that provides additional information about the load |
| 793 // state. Only used with the LOAD_STATE_WAITING_FOR_DELEGATE state. |
| 794 string16 load_state_param_; |
| 795 |
778 base::debug::LeakTracker<URLRequest> leak_tracker_; | 796 base::debug::LeakTracker<URLRequest> leak_tracker_; |
779 | 797 |
780 // Callback passed to the network delegate to notify us when a blocked request | 798 // Callback passed to the network delegate to notify us when a blocked request |
781 // is ready to be resumed or canceled. | 799 // is ready to be resumed or canceled. |
782 CompletionCallbackImpl<URLRequest> before_request_callback_; | 800 CompletionCallbackImpl<URLRequest> before_request_callback_; |
783 | 801 |
784 // Safe-guard to ensure that we do not send multiple "I am completed" | 802 // Safe-guard to ensure that we do not send multiple "I am completed" |
785 // messages to network delegate. | 803 // messages to network delegate. |
786 // TODO(battre): Remove this. http://crbug.com/89049 | 804 // TODO(battre): Remove this. http://crbug.com/89049 |
787 bool has_notified_completion_; | 805 bool has_notified_completion_; |
788 | 806 |
789 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 807 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
790 }; | 808 }; |
791 | 809 |
792 } // namespace net | 810 } // namespace net |
793 | 811 |
794 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 812 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |