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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 | 422 |
423 // Sets all extra request headers. Any extra request headers set by other | 423 // Sets all extra request headers. Any extra request headers set by other |
424 // methods are overwritten by this method. This method may only be called | 424 // methods are overwritten by this method. This method may only be called |
425 // before Start() is called. It is an error to call it later. | 425 // before Start() is called. It is an error to call it later. |
426 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); | 426 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); |
427 | 427 |
428 const HttpRequestHeaders& extra_request_headers() const { | 428 const HttpRequestHeaders& extra_request_headers() const { |
429 return extra_request_headers_; | 429 return extra_request_headers_; |
430 } | 430 } |
431 | 431 |
432 // Returns the current load state for the request. | 432 // Returns the current load state for the request. |param| is an optional |
willchan no longer on Chromium
2011/07/29 07:34:38
I think you're working forward from the assumption
Matt Perry
2011/07/29 21:30:49
Agreed, I took care to avoid this assumption. That
| |
433 LoadState GetLoadState() const; | 433 // parameter describing details related to the load state. Not all load states |
434 // have a parameter. | |
435 LoadStateWithParam GetLoadState() const; | |
436 void SetLoadStateParam(const std::string& param) { | |
437 load_state_param_ = param; | |
438 } | |
434 | 439 |
435 // Returns the current upload progress in bytes. | 440 // Returns the current upload progress in bytes. |
436 uint64 GetUploadProgress() const; | 441 uint64 GetUploadProgress() const; |
437 | 442 |
438 // Get response header(s) by ID or name. These methods may only be called | 443 // Get response header(s) by ID or name. These methods may only be called |
439 // once the delegate's OnResponseStarted method has been called. Headers | 444 // once the delegate's OnResponseStarted method has been called. Headers |
440 // that appear more than once in the response are coalesced, with values | 445 // that appear more than once in the response are coalesced, with values |
441 // separated by commas (per RFC 2616). This will not work with cookies since | 446 // separated by commas (per RFC 2616). This will not work with cookies since |
442 // comma can be used in cookie values. | 447 // comma can be used in cookie values. |
443 // TODO(darin): add API to enumerate response headers. | 448 // TODO(darin): add API to enumerate response headers. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 // This method can be called after the user selects a client certificate to | 601 // This method can be called after the user selects a client certificate to |
597 // instruct this URLRequest to continue with the request with the | 602 // instruct this URLRequest to continue with the request with the |
598 // certificate. Pass NULL if the user doesn't have a client certificate. | 603 // certificate. Pass NULL if the user doesn't have a client certificate. |
599 void ContinueWithCertificate(X509Certificate* client_cert); | 604 void ContinueWithCertificate(X509Certificate* client_cert); |
600 | 605 |
601 // This method can be called after some error notifications to instruct this | 606 // This method can be called after some error notifications to instruct this |
602 // URLRequest to ignore the current error and continue with the request. To | 607 // URLRequest to ignore the current error and continue with the request. To |
603 // cancel the request instead, call Cancel(). | 608 // cancel the request instead, call Cancel(). |
604 void ContinueDespiteLastError(); | 609 void ContinueDespiteLastError(); |
605 | 610 |
611 // Called when the delegate blocks or unblocks this request when intercepting | |
willchan no longer on Chromium
2011/07/29 07:34:38
These should be private. I think you made them pub
eroman
2011/08/05 01:54:22
Matt, can you address Will's comment? (Note that U
Matt Perry
2011/08/08 22:14:33
Done.
| |
612 // certain requests. | |
613 void SetBlockedOnDelegate(); | |
614 void SetUnblockedOnDelegate(); | |
615 | |
606 // Used to specify the context (cookie store, cache) for this request. | 616 // Used to specify the context (cookie store, cache) for this request. |
607 const URLRequestContext* context() const; | 617 const URLRequestContext* context() const; |
608 void set_context(const URLRequestContext* context); | 618 void set_context(const URLRequestContext* context); |
609 | 619 |
610 const BoundNetLog& net_log() const { return net_log_; } | 620 const BoundNetLog& net_log() const { return net_log_; } |
611 | 621 |
612 // Returns the expected content size if available | 622 // Returns the expected content size if available |
613 int64 GetExpectedContentSize() const; | 623 int64 GetExpectedContentSize() const; |
614 | 624 |
615 // Returns the priority level for this request. | 625 // Returns the priority level for this request. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 | 775 |
766 // TODO(battre): The only consumer of the identifier_ is currently the | 776 // TODO(battre): The only consumer of the identifier_ is currently the |
767 // web request API. We need to match identifiers of requests between the | 777 // web request API. We need to match identifiers of requests between the |
768 // web request API and the web navigation API. As the URLRequest does not | 778 // web request API and the web navigation API. As the URLRequest does not |
769 // exist when the web navigation API is triggered, the tracking probably | 779 // exist when the web navigation API is triggered, the tracking probably |
770 // needs to be done outside of the URLRequest anyway. Therefore, this | 780 // needs to be done outside of the URLRequest anyway. Therefore, this |
771 // identifier should be deleted here. http://crbug.com/89321 | 781 // identifier should be deleted here. http://crbug.com/89321 |
772 // A globally unique identifier for this request. | 782 // A globally unique identifier for this request. |
773 const uint64 identifier_; | 783 const uint64 identifier_; |
774 | 784 |
785 // True if this request is blocked waiting for the network delegate to resume | |
786 // it. | |
787 bool blocked_on_delegate_; | |
788 | |
789 // An optional parameter that provides additional information about the load | |
790 // state. Only used with the LOAD_STATE_WAITING_FOR_DELEGATE state. | |
791 std::string load_state_param_; | |
792 | |
775 base::debug::LeakTracker<URLRequest> leak_tracker_; | 793 base::debug::LeakTracker<URLRequest> leak_tracker_; |
776 | 794 |
777 // Callback passed to the network delegate to notify us when a blocked request | 795 // Callback passed to the network delegate to notify us when a blocked request |
778 // is ready to be resumed or canceled. | 796 // is ready to be resumed or canceled. |
779 CompletionCallbackImpl<URLRequest> before_request_callback_; | 797 CompletionCallbackImpl<URLRequest> before_request_callback_; |
780 | 798 |
781 // Safe-guard to ensure that we do not send multiple "I am completed" | 799 // Safe-guard to ensure that we do not send multiple "I am completed" |
782 // messages to network delegate. | 800 // messages to network delegate. |
783 // TODO(battre): Remove this. http://crbug.com/89049 | 801 // TODO(battre): Remove this. http://crbug.com/89049 |
784 bool has_notified_completion_; | 802 bool has_notified_completion_; |
785 | 803 |
786 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 804 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
787 }; | 805 }; |
788 | 806 |
789 } // namespace net | 807 } // namespace net |
790 | 808 |
791 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 809 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |