| 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 void Start(); | 541 void Start(); |
| 542 | 542 |
| 543 // This method may be called at any time after Start() has been called to | 543 // This method may be called at any time after Start() has been called to |
| 544 // cancel the request. This method may be called many times, and it has | 544 // cancel the request. This method may be called many times, and it has |
| 545 // no effect once the response has completed. It is guaranteed that no | 545 // no effect once the response has completed. It is guaranteed that no |
| 546 // methods of the delegate will be called after the request has been | 546 // methods of the delegate will be called after the request has been |
| 547 // cancelled, except that this may call the delegate's OnReadCompleted() | 547 // cancelled, except that this may call the delegate's OnReadCompleted() |
| 548 // during the call to Cancel itself. | 548 // during the call to Cancel itself. |
| 549 void Cancel(); | 549 void Cancel(); |
| 550 | 550 |
| 551 // Cancels the request and sets the error to |os_error| (see net_error_list.h | 551 // Cancels the request and sets the error to |error| (see net_error_list.h |
| 552 // for values). | 552 // for values). |
| 553 void SimulateError(int os_error); | 553 void SimulateError(int error); |
| 554 | 554 |
| 555 // Cancels the request and sets the error to |os_error| (see net_error_list.h | 555 // Cancels the request and sets the error to |error| (see net_error_list.h |
| 556 // for values) and attaches |ssl_info| as the SSLInfo for that request. This | 556 // for values) and attaches |ssl_info| as the SSLInfo for that request. This |
| 557 // is useful to attach a certificate and certificate error to a canceled | 557 // is useful to attach a certificate and certificate error to a canceled |
| 558 // request. | 558 // request. |
| 559 void SimulateSSLError(int os_error, const SSLInfo& ssl_info); | 559 void SimulateSSLError(int error, const SSLInfo& ssl_info); |
| 560 | 560 |
| 561 // Read initiates an asynchronous read from the response, and must only | 561 // Read initiates an asynchronous read from the response, and must only |
| 562 // be called after the OnResponseStarted callback is received with a | 562 // be called after the OnResponseStarted callback is received with a |
| 563 // successful status. | 563 // successful status. |
| 564 // If data is available, Read will return true, and the data and length will | 564 // If data is available, Read will return true, and the data and length will |
| 565 // be returned immediately. If data is not available, Read returns false, | 565 // be returned immediately. If data is not available, Read returns false, |
| 566 // and an asynchronous Read is initiated. The Read is finished when | 566 // and an asynchronous Read is initiated. The Read is finished when |
| 567 // the caller receives the OnReadComplete callback. Unless the request was | 567 // the caller receives the OnReadComplete callback. Unless the request was |
| 568 // cancelled, OnReadComplete will always be called, even if the read failed. | 568 // cancelled, OnReadComplete will always be called, even if the read failed. |
| 569 // | 569 // |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 void RestartWithJob(URLRequestJob* job); | 689 void RestartWithJob(URLRequestJob* job); |
| 690 void PrepareToRestart(); | 690 void PrepareToRestart(); |
| 691 | 691 |
| 692 // Detaches the job from this request in preparation for this object going | 692 // Detaches the job from this request in preparation for this object going |
| 693 // away or the job being replaced. The job will not call us back when it has | 693 // away or the job being replaced. The job will not call us back when it has |
| 694 // been orphaned. | 694 // been orphaned. |
| 695 void OrphanJob(); | 695 void OrphanJob(); |
| 696 | 696 |
| 697 // Cancels the request and set the error and ssl info for this request to the | 697 // Cancels the request and set the error and ssl info for this request to the |
| 698 // passed values. | 698 // passed values. |
| 699 void DoCancel(int os_error, const SSLInfo& ssl_info); | 699 void DoCancel(int error, const SSLInfo& ssl_info); |
| 700 | 700 |
| 701 // Notifies the network delegate that the request has been completed. | 701 // Notifies the network delegate that the request has been completed. |
| 702 // This does not imply a successful completion. Also a canceled request is | 702 // This does not imply a successful completion. Also a canceled request is |
| 703 // considered completed. | 703 // considered completed. |
| 704 void NotifyRequestCompleted(); | 704 void NotifyRequestCompleted(); |
| 705 | 705 |
| 706 // Called by URLRequestJob to allow interception when the final response | 706 // Called by URLRequestJob to allow interception when the final response |
| 707 // occurs. | 707 // occurs. |
| 708 void NotifyResponseStarted(); | 708 void NotifyResponseStarted(); |
| 709 | 709 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 // messages to network delegate. | 803 // messages to network delegate. |
| 804 // TODO(battre): Remove this. http://crbug.com/89049 | 804 // TODO(battre): Remove this. http://crbug.com/89049 |
| 805 bool has_notified_completion_; | 805 bool has_notified_completion_; |
| 806 | 806 |
| 807 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 807 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 808 }; | 808 }; |
| 809 | 809 |
| 810 } // namespace net | 810 } // namespace net |
| 811 | 811 |
| 812 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 812 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |