| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_FTP_FTP_TRANSACTION_H_ | 5 #ifndef NET_FTP_FTP_TRANSACTION_H_ |
| 6 #define NET_FTP_FTP_TRANSACTION_H_ | 6 #define NET_FTP_FTP_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
| 9 #include "net/base/io_buffer.h" |
| 9 #include "net/base/load_states.h" | 10 #include "net/base/load_states.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 class FtpRequestInfo; | 14 class FtpRequestInfo; |
| 14 class FtpResponseInfo; | 15 class FtpResponseInfo; |
| 15 | 16 |
| 16 // Represents a single FTP transaction. | 17 // Represents a single FTP transaction. |
| 17 class FtpTransaction { | 18 class FtpTransaction { |
| 18 public: | 19 public: |
| 19 // Stops any pending IO and destroys the transaction object. | 20 // Stops any pending IO and destroys the transaction object. |
| 20 virtual void Destroy() = 0; | 21 virtual ~FtpTransaction() {} |
| 21 | 22 |
| 22 // Starts the FTP transaction (i.e., sends the FTP request). | 23 // Starts the FTP transaction (i.e., sends the FTP request). |
| 23 // | 24 // |
| 24 // Returns OK if the transaction could be started synchronously, which means | 25 // Returns OK if the transaction could be started synchronously, which means |
| 25 // that the request was served from the cache (only supported for directory | 26 // that the request was served from the cache (only supported for directory |
| 26 // listings). ERR_IO_PENDING is returned to indicate that the | 27 // listings). ERR_IO_PENDING is returned to indicate that the |
| 27 // CompletionCallback will be notified once response info is available or if | 28 // CompletionCallback will be notified once response info is available or if |
| 28 // an IO error occurs. Any other return value indicates that the transaction | 29 // an IO error occurs. Any other return value indicates that the transaction |
| 29 // could not be started. | 30 // could not be started. |
| 30 // | 31 // |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 // Response data is copied into the given buffer and the number of bytes | 48 // Response data is copied into the given buffer and the number of bytes |
| 48 // copied is returned. ERR_IO_PENDING is returned if response data is not | 49 // copied is returned. ERR_IO_PENDING is returned if response data is not |
| 49 // yet available. The CompletionCallback is notified when the data copy | 50 // yet available. The CompletionCallback is notified when the data copy |
| 50 // completes, and it is passed the number of bytes that were successfully | 51 // completes, and it is passed the number of bytes that were successfully |
| 51 // copied. Or, if a read error occurs, the CompletionCallback is notified of | 52 // copied. Or, if a read error occurs, the CompletionCallback is notified of |
| 52 // the error. Any other negative return value indicates that the transaction | 53 // the error. Any other negative return value indicates that the transaction |
| 53 // could not be read. | 54 // could not be read. |
| 54 // | 55 // |
| 55 // NOTE: The transaction is not responsible for deleting the callback object. | 56 // NOTE: The transaction is not responsible for deleting the callback object. |
| 56 // | 57 // |
| 57 virtual int Read(char* buf, int buf_len, CompletionCallback* callback) = 0; | 58 virtual int Read(IOBuffer* buf, |
| 59 int buf_len, |
| 60 CompletionCallback* callback) = 0; |
| 58 | 61 |
| 59 // Returns the response info for this transaction or NULL if the response | 62 // Returns the response info for this transaction or NULL if the response |
| 60 // info is not available. | 63 // info is not available. |
| 61 virtual const FtpResponseInfo* GetResponseInfo() const = 0; | 64 virtual const FtpResponseInfo* GetResponseInfo() const = 0; |
| 62 | 65 |
| 63 // Returns the load state for this transaction. | 66 // Returns the load state for this transaction. |
| 64 virtual LoadState GetLoadState() const = 0; | 67 virtual LoadState GetLoadState() const = 0; |
| 65 | 68 |
| 66 // Returns the upload progress in bytes. If there is no upload data, | 69 // Returns the upload progress in bytes. If there is no upload data, |
| 67 // zero will be returned. This does not include the request headers. | 70 // zero will be returned. |
| 68 virtual uint64 GetUploadProgress() const = 0; | 71 virtual uint64 GetUploadProgress() const = 0; |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace net | 74 } // namespace net |
| 72 | 75 |
| 73 #endif // NET_FTP_FTP_TRANSACTION_H_ | 76 #endif // NET_FTP_FTP_TRANSACTION_H_ |
| OLD | NEW |