OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_HTTP_HTTP_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
11 #include "net/base/load_states.h" | 11 #include "net/base/load_states.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
| 15 class BoundNetLog; |
15 class HttpRequestInfo; | 16 class HttpRequestInfo; |
16 class HttpResponseInfo; | 17 class HttpResponseInfo; |
17 class IOBuffer; | 18 class IOBuffer; |
18 class LoadLog; | |
19 class X509Certificate; | 19 class X509Certificate; |
20 | 20 |
21 // Represents a single HTTP transaction (i.e., a single request/response pair). | 21 // Represents a single HTTP transaction (i.e., a single request/response pair). |
22 // HTTP redirects are not followed and authentication challenges are not | 22 // HTTP redirects are not followed and authentication challenges are not |
23 // answered. Cookies are assumed to be managed by the caller. | 23 // answered. Cookies are assumed to be managed by the caller. |
24 class HttpTransaction { | 24 class HttpTransaction { |
25 public: | 25 public: |
26 // Stops any pending IO and destroys the transaction object. | 26 // Stops any pending IO and destroys the transaction object. |
27 virtual ~HttpTransaction() {} | 27 virtual ~HttpTransaction() {} |
28 | 28 |
29 // Starts the HTTP transaction (i.e., sends the HTTP request). | 29 // Starts the HTTP transaction (i.e., sends the HTTP request). |
30 // | 30 // |
31 // Returns OK if the transaction could be started synchronously, which means | 31 // Returns OK if the transaction could be started synchronously, which means |
32 // that the request was served from the cache. ERR_IO_PENDING is returned to | 32 // that the request was served from the cache. ERR_IO_PENDING is returned to |
33 // indicate that the CompletionCallback will be notified once response info | 33 // indicate that the CompletionCallback will be notified once response info |
34 // is available or if an IO error occurs. Any other return value indicates | 34 // is available or if an IO error occurs. Any other return value indicates |
35 // that the transaction could not be started. | 35 // that the transaction could not be started. |
36 // | 36 // |
37 // Regardless of the return value, the caller is expected to keep the | 37 // Regardless of the return value, the caller is expected to keep the |
38 // request_info object alive until Destroy is called on the transaction. | 38 // request_info object alive until Destroy is called on the transaction. |
39 // | 39 // |
40 // NOTE: The transaction is not responsible for deleting the callback object. | 40 // NOTE: The transaction is not responsible for deleting the callback object. |
41 // | 41 // |
42 // Profiling information for the request is saved to |load_log| if non-NULL. | 42 // Profiling information for the request is saved to |net_log| if non-NULL. |
43 virtual int Start(const HttpRequestInfo* request_info, | 43 virtual int Start(const HttpRequestInfo* request_info, |
44 CompletionCallback* callback, | 44 CompletionCallback* callback, |
45 LoadLog* load_log) = 0; | 45 const BoundNetLog& net_log) = 0; |
46 | 46 |
47 // Restarts the HTTP transaction, ignoring the last error. This call can | 47 // Restarts the HTTP transaction, ignoring the last error. This call can |
48 // only be made after a call to Start (or RestartIgnoringLastError) failed. | 48 // only be made after a call to Start (or RestartIgnoringLastError) failed. |
49 // Once Read has been called, this method cannot be called. This method is | 49 // Once Read has been called, this method cannot be called. This method is |
50 // used, for example, to continue past various SSL related errors. | 50 // used, for example, to continue past various SSL related errors. |
51 // | 51 // |
52 // Not all errors can be ignored using this method. See error code | 52 // Not all errors can be ignored using this method. See error code |
53 // descriptions for details about errors that can be ignored. | 53 // descriptions for details about errors that can be ignored. |
54 // | 54 // |
55 // NOTE: The transaction is not responsible for deleting the callback object. | 55 // NOTE: The transaction is not responsible for deleting the callback object. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 virtual LoadState GetLoadState() const = 0; | 102 virtual LoadState GetLoadState() const = 0; |
103 | 103 |
104 // Returns the upload progress in bytes. If there is no upload data, | 104 // Returns the upload progress in bytes. If there is no upload data, |
105 // zero will be returned. This does not include the request headers. | 105 // zero will be returned. This does not include the request headers. |
106 virtual uint64 GetUploadProgress() const = 0; | 106 virtual uint64 GetUploadProgress() const = 0; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace net | 109 } // namespace net |
110 | 110 |
111 #endif // NET_HTTP_HTTP_TRANSACTION_H_ | 111 #endif // NET_HTTP_HTTP_TRANSACTION_H_ |
OLD | NEW |