Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: net/http/http_transaction.h

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/load_states.h" 10 #include "net/base/load_states.h"
(...skipping 14 matching lines...) Expand all
25 // answered. Cookies are assumed to be managed by the caller. 25 // answered. Cookies are assumed to be managed by the caller.
26 class NET_EXPORT_PRIVATE HttpTransaction { 26 class NET_EXPORT_PRIVATE HttpTransaction {
27 public: 27 public:
28 // Stops any pending IO and destroys the transaction object. 28 // Stops any pending IO and destroys the transaction object.
29 virtual ~HttpTransaction() {} 29 virtual ~HttpTransaction() {}
30 30
31 // Starts the HTTP transaction (i.e., sends the HTTP request). 31 // Starts the HTTP transaction (i.e., sends the HTTP request).
32 // 32 //
33 // Returns OK if the transaction could be started synchronously, which means 33 // Returns OK if the transaction could be started synchronously, which means
34 // that the request was served from the cache. ERR_IO_PENDING is returned to 34 // that the request was served from the cache. ERR_IO_PENDING is returned to
35 // indicate that the OldCompletionCallback will be notified once response info 35 // indicate that the CompletionCallback will be notified once response info is
36 // is available or if an IO error occurs. Any other return value indicates 36 // available or if an IO error occurs. Any other return value indicates that
37 // that the transaction could not be started. 37 // the transaction could not be started.
38 // 38 //
39 // Regardless of the return value, the caller is expected to keep the 39 // Regardless of the return value, the caller is expected to keep the
40 // request_info object alive until Destroy is called on the transaction. 40 // request_info object alive until Destroy is called on the transaction.
41 // 41 //
42 // NOTE: The transaction is not responsible for deleting the callback object. 42 // NOTE: The transaction is not responsible for deleting the callback object.
43 // 43 //
44 // Profiling information for the request is saved to |net_log| if non-NULL. 44 // Profiling information for the request is saved to |net_log| if non-NULL.
45 virtual int Start(const HttpRequestInfo* request_info, 45 virtual int Start(const HttpRequestInfo* request_info,
46 OldCompletionCallback* callback, 46 const CompletionCallback& callback,
47 const BoundNetLog& net_log) = 0; 47 const BoundNetLog& net_log) = 0;
48 48
49 // Restarts the HTTP transaction, ignoring the last error. This call can 49 // Restarts the HTTP transaction, ignoring the last error. This call can
50 // only be made after a call to Start (or RestartIgnoringLastError) failed. 50 // only be made after a call to Start (or RestartIgnoringLastError) failed.
51 // Once Read has been called, this method cannot be called. This method is 51 // Once Read has been called, this method cannot be called. This method is
52 // used, for example, to continue past various SSL related errors. 52 // used, for example, to continue past various SSL related errors.
53 // 53 //
54 // Not all errors can be ignored using this method. See error code 54 // Not all errors can be ignored using this method. See error code
55 // descriptions for details about errors that can be ignored. 55 // descriptions for details about errors that can be ignored.
56 // 56 //
57 // NOTE: The transaction is not responsible for deleting the callback object. 57 // NOTE: The transaction is not responsible for deleting the callback object.
58 // 58 //
59 virtual int RestartIgnoringLastError(OldCompletionCallback* callback) = 0; 59 virtual int RestartIgnoringLastError(const CompletionCallback& callback) = 0;
60 60
61 // Restarts the HTTP transaction with a client certificate. 61 // Restarts the HTTP transaction with a client certificate.
62 virtual int RestartWithCertificate(X509Certificate* client_cert, 62 virtual int RestartWithCertificate(X509Certificate* client_cert,
63 OldCompletionCallback* callback) = 0; 63 const CompletionCallback& callback) = 0;
64 64
65 // Restarts the HTTP transaction with authentication credentials. 65 // Restarts the HTTP transaction with authentication credentials.
66 virtual int RestartWithAuth(const AuthCredentials& credentials, 66 virtual int RestartWithAuth(const AuthCredentials& credentials,
67 OldCompletionCallback* callback) = 0; 67 const CompletionCallback& callback) = 0;
68 68
69 // Returns true if auth is ready to be continued. Callers should check 69 // Returns true if auth is ready to be continued. Callers should check
70 // this value anytime Start() completes: if it is true, the transaction 70 // this value anytime Start() completes: if it is true, the transaction
71 // can be resumed with RestartWithAuth(L"", L"", callback) to resume 71 // can be resumed with RestartWithAuth(L"", L"", callback) to resume
72 // the automatic auth exchange. This notification gives the caller a 72 // the automatic auth exchange. This notification gives the caller a
73 // chance to process the response headers from all of the intermediate 73 // chance to process the response headers from all of the intermediate
74 // restarts needed for authentication. 74 // restarts needed for authentication.
75 virtual bool IsReadyToRestartForAuth() = 0; 75 virtual bool IsReadyToRestartForAuth() = 0;
76 76
77 // Once response info is available for the transaction, response data may be 77 // Once response info is available for the transaction, response data may be
78 // read by calling this method. 78 // read by calling this method.
79 // 79 //
80 // Response data is copied into the given buffer and the number of bytes 80 // Response data is copied into the given buffer and the number of bytes
81 // copied is returned. ERR_IO_PENDING is returned if response data is not 81 // copied is returned. ERR_IO_PENDING is returned if response data is not
82 // yet available. The OldCompletionCallback is notified when the data copy 82 // yet available. The CompletionCallback is notified when the data copy
83 // completes, and it is passed the number of bytes that were successfully 83 // completes, and it is passed the number of bytes that were successfully
84 // copied. Or, if a read error occurs, the OldCompletionCallback is notified of 84 // copied. Or, if a read error occurs, the CompletionCallback is notified of
85 // the error. Any other negative return value indicates that the transaction 85 // the error. Any other negative return value indicates that the transaction
86 // could not be read. 86 // could not be read.
87 // 87 //
88 // NOTE: The transaction is not responsible for deleting the callback object. 88 // NOTE: The transaction is not responsible for deleting the callback object.
89 // If the operation is not completed immediately, the transaction must acquire 89 // If the operation is not completed immediately, the transaction must acquire
90 // a reference to the provided buffer. 90 // a reference to the provided buffer.
91 // 91 //
92 virtual int Read(IOBuffer* buf, int buf_len, 92 virtual int Read(IOBuffer* buf, int buf_len,
93 OldCompletionCallback* callback) = 0; 93 const CompletionCallback& callback) = 0;
94 94
95 // Stops further caching of this request by the HTTP cache, if there is any. 95 // Stops further caching of this request by the HTTP cache, if there is any.
96 virtual void StopCaching() = 0; 96 virtual void StopCaching() = 0;
97 97
98 // Called to tell the transaction that we have successfully reached the end 98 // Called to tell the transaction that we have successfully reached the end
99 // of the stream. This is equivalent to performing an extra Read() at the end 99 // of the stream. This is equivalent to performing an extra Read() at the end
100 // that should return 0 bytes. This method should not be called if the 100 // that should return 0 bytes. This method should not be called if the
101 // transaction is busy processing a previous operation (like a pending Read). 101 // transaction is busy processing a previous operation (like a pending Read).
102 virtual void DoneReading() = 0; 102 virtual void DoneReading() = 0;
103 103
(...skipping 10 matching lines...) Expand all
114 114
115 // SetSSLHostInfo sets a object which reads and writes public information 115 // SetSSLHostInfo sets a object which reads and writes public information
116 // about an SSL server. It's used to implement Snap Start. 116 // about an SSL server. It's used to implement Snap Start.
117 // TODO(agl): remove this. 117 // TODO(agl): remove this.
118 virtual void SetSSLHostInfo(SSLHostInfo*) { }; 118 virtual void SetSSLHostInfo(SSLHostInfo*) { };
119 }; 119 };
120 120
121 } // namespace net 121 } // namespace net
122 122
123 #endif // NET_HTTP_HTTP_TRANSACTION_H_ 123 #endif // NET_HTTP_HTTP_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698