| 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_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 #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/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class NET_EXPORT_PRIVATE FtpTransaction { | 22 class NET_EXPORT_PRIVATE FtpTransaction { |
| 23 public: | 23 public: |
| 24 // Stops any pending IO and destroys the transaction object. | 24 // Stops any pending IO and destroys the transaction object. |
| 25 virtual ~FtpTransaction() {} | 25 virtual ~FtpTransaction() {} |
| 26 | 26 |
| 27 // Starts the FTP transaction (i.e., sends the FTP request). | 27 // Starts the FTP transaction (i.e., sends the FTP request). |
| 28 // | 28 // |
| 29 // Returns OK if the transaction could be started synchronously, which means | 29 // Returns OK if the transaction could be started synchronously, which means |
| 30 // that the request was served from the cache (only supported for directory | 30 // that the request was served from the cache (only supported for directory |
| 31 // listings). ERR_IO_PENDING is returned to indicate that the | 31 // listings). ERR_IO_PENDING is returned to indicate that the |
| 32 // OldCompletionCallback will be notified once response info is available or i
f | 32 // CompletionCallback will be notified once response info is available or if |
| 33 // an IO error occurs. Any other return value indicates that the transaction | 33 // an IO error occurs. Any other return value indicates that the transaction |
| 34 // could not be started. | 34 // could not be started. |
| 35 // | 35 // |
| 36 // Regardless of the return value, the caller is expected to keep the | 36 // Regardless of the return value, the caller is expected to keep the |
| 37 // request_info object alive until Destroy is called on the transaction. | 37 // request_info object alive until Destroy is called on the transaction. |
| 38 // | 38 // |
| 39 // NOTE: The transaction is not responsible for deleting the callback object. | 39 // NOTE: The transaction is not responsible for deleting the callback object. |
| 40 // | 40 // |
| 41 // Profiling information for the request is saved to |net_log| if non-NULL. | 41 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 42 virtual int Start(const FtpRequestInfo* request_info, | 42 virtual int Start(const FtpRequestInfo* request_info, |
| 43 OldCompletionCallback* callback, | 43 const CompletionCallback& callback, |
| 44 const BoundNetLog& net_log) = 0; | 44 const BoundNetLog& net_log) = 0; |
| 45 | 45 |
| 46 // Restarts the FTP transaction with authentication credentials. | 46 // Restarts the FTP transaction with authentication credentials. |
| 47 virtual int RestartWithAuth(const AuthCredentials& credentials, | 47 virtual int RestartWithAuth(const AuthCredentials& credentials, |
| 48 OldCompletionCallback* callback) = 0; | 48 const CompletionCallback& callback) = 0; |
| 49 | 49 |
| 50 // Once response info is available for the transaction, response data may be | 50 // Once response info is available for the transaction, response data may be |
| 51 // read by calling this method. | 51 // read by calling this method. |
| 52 // | 52 // |
| 53 // Response data is copied into the given buffer and the number of bytes | 53 // Response data is copied into the given buffer and the number of bytes |
| 54 // copied is returned. ERR_IO_PENDING is returned if response data is not | 54 // copied is returned. ERR_IO_PENDING is returned if response data is not |
| 55 // yet available. The OldCompletionCallback is notified when the data copy | 55 // yet available. The CompletionCallback is notified when the data copy |
| 56 // completes, and it is passed the number of bytes that were successfully | 56 // completes, and it is passed the number of bytes that were successfully |
| 57 // copied. Or, if a read error occurs, the OldCompletionCallback is notified
of | 57 // copied. Or, if a read error occurs, the CompletionCallback is notified of |
| 58 // the error. Any other negative return value indicates that the transaction | 58 // the error. Any other negative return value indicates that the transaction |
| 59 // could not be read. | 59 // could not be read. |
| 60 // | 60 // |
| 61 // NOTE: The transaction is not responsible for deleting the callback object. | 61 // NOTE: The transaction is not responsible for deleting the callback object. |
| 62 // | 62 // |
| 63 virtual int Read(IOBuffer* buf, | 63 virtual int Read(IOBuffer* buf, |
| 64 int buf_len, | 64 int buf_len, |
| 65 OldCompletionCallback* callback) = 0; | 65 const CompletionCallback& callback) = 0; |
| 66 | 66 |
| 67 // Returns the response info for this transaction or NULL if the response | 67 // Returns the response info for this transaction or NULL if the response |
| 68 // info is not available. | 68 // info is not available. |
| 69 virtual const FtpResponseInfo* GetResponseInfo() const = 0; | 69 virtual const FtpResponseInfo* GetResponseInfo() const = 0; |
| 70 | 70 |
| 71 // Returns the load state for this transaction. | 71 // Returns the load state for this transaction. |
| 72 virtual LoadState GetLoadState() const = 0; | 72 virtual LoadState GetLoadState() const = 0; |
| 73 | 73 |
| 74 // Returns the upload progress in bytes. If there is no upload data, | 74 // Returns the upload progress in bytes. If there is no upload data, |
| 75 // zero will be returned. | 75 // zero will be returned. |
| 76 virtual uint64 GetUploadProgress() const = 0; | 76 virtual uint64 GetUploadProgress() const = 0; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace net | 79 } // namespace net |
| 80 | 80 |
| 81 #endif // NET_FTP_FTP_TRANSACTION_H_ | 81 #endif // NET_FTP_FTP_TRANSACTION_H_ |
| OLD | NEW |