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/io_buffer.h" |
10 #include "net/base/load_states.h" | 10 #include "net/base/load_states.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 class FtpRequestInfo; | 14 class FtpRequestInfo; |
15 class FtpResponseInfo; | 15 class FtpResponseInfo; |
| 16 class LoadLog; |
16 | 17 |
17 // Represents a single FTP transaction. | 18 // Represents a single FTP transaction. |
18 class FtpTransaction { | 19 class FtpTransaction { |
19 public: | 20 public: |
20 // Stops any pending IO and destroys the transaction object. | 21 // Stops any pending IO and destroys the transaction object. |
21 virtual ~FtpTransaction() {} | 22 virtual ~FtpTransaction() {} |
22 | 23 |
23 // Starts the FTP transaction (i.e., sends the FTP request). | 24 // Starts the FTP transaction (i.e., sends the FTP request). |
24 // | 25 // |
25 // Returns OK if the transaction could be started synchronously, which means | 26 // Returns OK if the transaction could be started synchronously, which means |
26 // that the request was served from the cache (only supported for directory | 27 // that the request was served from the cache (only supported for directory |
27 // listings). ERR_IO_PENDING is returned to indicate that the | 28 // listings). ERR_IO_PENDING is returned to indicate that the |
28 // CompletionCallback will be notified once response info is available or if | 29 // CompletionCallback will be notified once response info is available or if |
29 // an IO error occurs. Any other return value indicates that the transaction | 30 // an IO error occurs. Any other return value indicates that the transaction |
30 // could not be started. | 31 // could not be started. |
31 // | 32 // |
32 // Regardless of the return value, the caller is expected to keep the | 33 // Regardless of the return value, the caller is expected to keep the |
33 // request_info object alive until Destroy is called on the transaction. | 34 // request_info object alive until Destroy is called on the transaction. |
34 // | 35 // |
35 // NOTE: The transaction is not responsible for deleting the callback object. | 36 // NOTE: The transaction is not responsible for deleting the callback object. |
36 // | 37 // |
37 virtual int Start(const FtpRequestInfo* request_info, | 38 // Profiling information for the request is saved to |load_log| if non-NULL. |
| 39 virtual int Start(LoadLog* load_log, |
| 40 const FtpRequestInfo* request_info, |
38 CompletionCallback* callback) = 0; | 41 CompletionCallback* callback) = 0; |
39 | 42 |
40 // Restarts the FTP transaction with authentication credentials. | 43 // Restarts the FTP transaction with authentication credentials. |
41 virtual int RestartWithAuth(const std::wstring& username, | 44 virtual int RestartWithAuth(const std::wstring& username, |
42 const std::wstring& password, | 45 const std::wstring& password, |
43 CompletionCallback* callback) = 0; | 46 CompletionCallback* callback) = 0; |
44 | 47 |
45 // Once response info is available for the transaction, response data may be | 48 // Once response info is available for the transaction, response data may be |
46 // read by calling this method. | 49 // read by calling this method. |
47 // | 50 // |
(...skipping 19 matching lines...) Loading... |
67 virtual LoadState GetLoadState() const = 0; | 70 virtual LoadState GetLoadState() const = 0; |
68 | 71 |
69 // Returns the upload progress in bytes. If there is no upload data, | 72 // Returns the upload progress in bytes. If there is no upload data, |
70 // zero will be returned. | 73 // zero will be returned. |
71 virtual uint64 GetUploadProgress() const = 0; | 74 virtual uint64 GetUploadProgress() const = 0; |
72 }; | 75 }; |
73 | 76 |
74 } // namespace net | 77 } // namespace net |
75 | 78 |
76 #endif // NET_FTP_FTP_TRANSACTION_H_ | 79 #endif // NET_FTP_FTP_TRANSACTION_H_ |
OLD | NEW |