| 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/load_states.h" | 12 #include "net/base/load_states.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class AuthCredentials; | 17 class AuthCredentials; |
| 18 class FtpResponseInfo; | 18 class FtpResponseInfo; |
| 19 class FtpRequestInfo; | 19 class FtpRequestInfo; |
| 20 class BoundNetLog; | 20 class NetLogWithSource; |
| 21 | 21 |
| 22 // Represents a single FTP transaction. | 22 // Represents a single FTP transaction. |
| 23 class NET_EXPORT_PRIVATE FtpTransaction { | 23 class NET_EXPORT_PRIVATE FtpTransaction { |
| 24 public: | 24 public: |
| 25 // Stops any pending IO and destroys the transaction object. | 25 // Stops any pending IO and destroys the transaction object. |
| 26 virtual ~FtpTransaction() {} | 26 virtual ~FtpTransaction() {} |
| 27 | 27 |
| 28 // Starts the FTP transaction (i.e., sends the FTP request). | 28 // Starts the FTP transaction (i.e., sends the FTP request). |
| 29 // | 29 // |
| 30 // Returns OK if the transaction could be started synchronously, which means | 30 // Returns OK if the transaction could be started synchronously, which means |
| 31 // that the request was served from the cache (only supported for directory | 31 // that the request was served from the cache (only supported for directory |
| 32 // listings). ERR_IO_PENDING is returned to indicate that the | 32 // listings). ERR_IO_PENDING is returned to indicate that the |
| 33 // CompletionCallback will be notified once response info is available or if | 33 // CompletionCallback will be notified once response info is available or if |
| 34 // an IO error occurs. Any other return value indicates that the transaction | 34 // an IO error occurs. Any other return value indicates that the transaction |
| 35 // could not be started. | 35 // 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 |net_log| if non-NULL. | 42 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 43 virtual int Start(const FtpRequestInfo* request_info, | 43 virtual int Start(const FtpRequestInfo* request_info, |
| 44 const CompletionCallback& callback, | 44 const CompletionCallback& callback, |
| 45 const BoundNetLog& net_log) = 0; | 45 const NetLogWithSource& net_log) = 0; |
| 46 | 46 |
| 47 // Restarts the FTP transaction with authentication credentials. | 47 // Restarts the FTP transaction with authentication credentials. |
| 48 virtual int RestartWithAuth(const AuthCredentials& credentials, | 48 virtual int RestartWithAuth(const AuthCredentials& credentials, |
| 49 const CompletionCallback& callback) = 0; | 49 const CompletionCallback& callback) = 0; |
| 50 | 50 |
| 51 // Once response info is available for the transaction, response data may be | 51 // Once response info is available for the transaction, response data may be |
| 52 // read by calling this method. | 52 // read by calling this method. |
| 53 // | 53 // |
| 54 // Response data is copied into the given buffer and the number of bytes | 54 // Response data is copied into the given buffer and the number of bytes |
| 55 // copied is returned. ERR_IO_PENDING is returned if response data is not | 55 // copied is returned. ERR_IO_PENDING is returned if response data is not |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 virtual LoadState GetLoadState() const = 0; | 73 virtual LoadState GetLoadState() const = 0; |
| 74 | 74 |
| 75 // Returns the upload progress in bytes. If there is no upload data, | 75 // Returns the upload progress in bytes. If there is no upload data, |
| 76 // zero will be returned. | 76 // zero will be returned. |
| 77 virtual uint64_t GetUploadProgress() const = 0; | 77 virtual uint64_t GetUploadProgress() const = 0; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace net | 80 } // namespace net |
| 81 | 81 |
| 82 #endif // NET_FTP_FTP_TRANSACTION_H_ | 82 #endif // NET_FTP_FTP_TRANSACTION_H_ |
| OLD | NEW |