OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
6 #define NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 6 #define NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <queue> |
9 #include <string> | 10 #include <string> |
10 #include <queue> | |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "base/string16.h" |
16 #include "net/base/address_list.h" | 17 #include "net/base/address_list.h" |
17 #include "net/base/host_resolver.h" | 18 #include "net/base/host_resolver.h" |
18 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
19 #include "net/ftp/ftp_ctrl_response_buffer.h" | 20 #include "net/ftp/ftp_ctrl_response_buffer.h" |
20 #include "net/ftp/ftp_response_info.h" | 21 #include "net/ftp/ftp_response_info.h" |
21 #include "net/ftp/ftp_transaction.h" | 22 #include "net/ftp/ftp_transaction.h" |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 | 25 |
25 class ClientSocket; | 26 class ClientSocket; |
26 class ClientSocketFactory; | 27 class ClientSocketFactory; |
27 class FtpNetworkSession; | 28 class FtpNetworkSession; |
28 | 29 |
29 class FtpNetworkTransaction : public FtpTransaction { | 30 class FtpNetworkTransaction : public FtpTransaction { |
30 public: | 31 public: |
31 FtpNetworkTransaction(FtpNetworkSession* session, | 32 FtpNetworkTransaction(FtpNetworkSession* session, |
32 ClientSocketFactory* socket_factory); | 33 ClientSocketFactory* socket_factory); |
33 virtual ~FtpNetworkTransaction(); | 34 virtual ~FtpNetworkTransaction(); |
34 | 35 |
35 // FtpTransaction methods: | 36 // FtpTransaction methods: |
36 virtual int Start(const FtpRequestInfo* request_info, | 37 virtual int Start(const FtpRequestInfo* request_info, |
37 CompletionCallback* callback, | 38 CompletionCallback* callback, |
38 const BoundNetLog& net_log); | 39 const BoundNetLog& net_log); |
39 virtual int Stop(int error); | 40 virtual int Stop(int error); |
40 virtual int RestartWithAuth(const std::wstring& username, | 41 virtual int RestartWithAuth(const string16& username, |
41 const std::wstring& password, | 42 const string16& password, |
42 CompletionCallback* callback); | 43 CompletionCallback* callback); |
43 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 44 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
44 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 45 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
45 virtual const FtpResponseInfo* GetResponseInfo() const; | 46 virtual const FtpResponseInfo* GetResponseInfo() const; |
46 virtual LoadState GetLoadState() const; | 47 virtual LoadState GetLoadState() const; |
47 virtual uint64 GetUploadProgress() const; | 48 virtual uint64 GetUploadProgress() const; |
48 | 49 |
49 private: | 50 private: |
50 enum Command { | 51 enum Command { |
51 COMMAND_NONE, | 52 COMMAND_NONE, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Data type to be used for the TYPE command. | 195 // Data type to be used for the TYPE command. |
195 DataType data_type_; | 196 DataType data_type_; |
196 | 197 |
197 // Detected resource type (file or directory). | 198 // Detected resource type (file or directory). |
198 ResourceType resource_type_; | 199 ResourceType resource_type_; |
199 | 200 |
200 // Initially we favour EPSV over PASV for transfers but should any | 201 // Initially we favour EPSV over PASV for transfers but should any |
201 // EPSV fail, we fall back to PASV for the duration of connection. | 202 // EPSV fail, we fall back to PASV for the duration of connection. |
202 bool use_epsv_; | 203 bool use_epsv_; |
203 | 204 |
204 // We get username and password as wstrings in RestartWithAuth, so they are | 205 string16 username_; |
205 // also kept as wstrings here. | 206 string16 password_; |
206 std::wstring username_; | |
207 std::wstring password_; | |
208 | 207 |
209 // Current directory on the remote server, as returned by last PWD command, | 208 // Current directory on the remote server, as returned by last PWD command, |
210 // with any trailing slash removed. | 209 // with any trailing slash removed. |
211 std::string current_remote_directory_; | 210 std::string current_remote_directory_; |
212 | 211 |
213 int data_connection_port_; | 212 int data_connection_port_; |
214 | 213 |
215 ClientSocketFactory* socket_factory_; | 214 ClientSocketFactory* socket_factory_; |
216 | 215 |
217 scoped_ptr<ClientSocket> ctrl_socket_; | 216 scoped_ptr<ClientSocket> ctrl_socket_; |
(...skipping 28 matching lines...) Expand all Loading... |
246 STATE_DATA_READ, | 245 STATE_DATA_READ, |
247 STATE_DATA_READ_COMPLETE, | 246 STATE_DATA_READ_COMPLETE, |
248 STATE_NONE | 247 STATE_NONE |
249 }; | 248 }; |
250 State next_state_; | 249 State next_state_; |
251 }; | 250 }; |
252 | 251 |
253 } // namespace net | 252 } // namespace net |
254 | 253 |
255 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 254 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |