| 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_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 <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/string16.h" | |
| 16 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
| 16 #include "net/base/auth.h" |
| 17 #include "net/base/host_resolver.h" | 17 #include "net/base/host_resolver.h" |
| 18 #include "net/base/net_log.h" | 18 #include "net/base/net_log.h" |
| 19 #include "net/base/single_request_host_resolver.h" | 19 #include "net/base/single_request_host_resolver.h" |
| 20 #include "net/ftp/ftp_ctrl_response_buffer.h" | 20 #include "net/ftp/ftp_ctrl_response_buffer.h" |
| 21 #include "net/ftp/ftp_response_info.h" | 21 #include "net/ftp/ftp_response_info.h" |
| 22 #include "net/ftp/ftp_transaction.h" | 22 #include "net/ftp/ftp_transaction.h" |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 | 25 |
| 26 class ClientSocketFactory; | 26 class ClientSocketFactory; |
| 27 class FtpNetworkSession; | 27 class FtpNetworkSession; |
| 28 class StreamSocket; | 28 class StreamSocket; |
| 29 | 29 |
| 30 class NET_EXPORT_PRIVATE FtpNetworkTransaction : public FtpTransaction { | 30 class NET_EXPORT_PRIVATE FtpNetworkTransaction : public FtpTransaction { |
| 31 public: | 31 public: |
| 32 FtpNetworkTransaction(FtpNetworkSession* session, | 32 FtpNetworkTransaction(FtpNetworkSession* session, |
| 33 ClientSocketFactory* socket_factory); | 33 ClientSocketFactory* socket_factory); |
| 34 virtual ~FtpNetworkTransaction(); | 34 virtual ~FtpNetworkTransaction(); |
| 35 | 35 |
| 36 virtual int Stop(int error); | 36 virtual int Stop(int error); |
| 37 virtual int RestartIgnoringLastError(OldCompletionCallback* callback); | 37 virtual int RestartIgnoringLastError(OldCompletionCallback* callback); |
| 38 | 38 |
| 39 // FtpTransaction methods: | 39 // FtpTransaction methods: |
| 40 virtual int Start(const FtpRequestInfo* request_info, | 40 virtual int Start(const FtpRequestInfo* request_info, |
| 41 OldCompletionCallback* callback, | 41 OldCompletionCallback* callback, |
| 42 const BoundNetLog& net_log) OVERRIDE; | 42 const BoundNetLog& net_log) OVERRIDE; |
| 43 virtual int RestartWithAuth(const string16& username, | 43 virtual int RestartWithAuth(const AuthCredentials& credentials, |
| 44 const string16& password, | |
| 45 OldCompletionCallback* callback) OVERRIDE; | 44 OldCompletionCallback* callback) OVERRIDE; |
| 46 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) | 45 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) |
| 47 OVERRIDE; | 46 OVERRIDE; |
| 48 virtual const FtpResponseInfo* GetResponseInfo() const OVERRIDE; | 47 virtual const FtpResponseInfo* GetResponseInfo() const OVERRIDE; |
| 49 virtual LoadState GetLoadState() const OVERRIDE; | 48 virtual LoadState GetLoadState() const OVERRIDE; |
| 50 virtual uint64 GetUploadProgress() const OVERRIDE; | 49 virtual uint64 GetUploadProgress() const OVERRIDE; |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 enum Command { | 52 enum Command { |
| 54 COMMAND_NONE, | 53 COMMAND_NONE, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // Data type to be used for the TYPE command. | 224 // Data type to be used for the TYPE command. |
| 226 DataType data_type_; | 225 DataType data_type_; |
| 227 | 226 |
| 228 // Detected resource type (file or directory). | 227 // Detected resource type (file or directory). |
| 229 ResourceType resource_type_; | 228 ResourceType resource_type_; |
| 230 | 229 |
| 231 // Initially we favour EPSV over PASV for transfers but should any | 230 // Initially we favour EPSV over PASV for transfers but should any |
| 232 // EPSV fail, we fall back to PASV for the duration of connection. | 231 // EPSV fail, we fall back to PASV for the duration of connection. |
| 233 bool use_epsv_; | 232 bool use_epsv_; |
| 234 | 233 |
| 235 string16 username_; | 234 AuthCredentials credentials_; |
| 236 string16 password_; | |
| 237 | 235 |
| 238 // Current directory on the remote server, as returned by last PWD command, | 236 // Current directory on the remote server, as returned by last PWD command, |
| 239 // with any trailing slash removed. | 237 // with any trailing slash removed. |
| 240 std::string current_remote_directory_; | 238 std::string current_remote_directory_; |
| 241 | 239 |
| 242 int data_connection_port_; | 240 int data_connection_port_; |
| 243 | 241 |
| 244 ClientSocketFactory* socket_factory_; | 242 ClientSocketFactory* socket_factory_; |
| 245 | 243 |
| 246 scoped_ptr<StreamSocket> ctrl_socket_; | 244 scoped_ptr<StreamSocket> ctrl_socket_; |
| 247 scoped_ptr<StreamSocket> data_socket_; | 245 scoped_ptr<StreamSocket> data_socket_; |
| 248 | 246 |
| 249 State next_state_; | 247 State next_state_; |
| 250 }; | 248 }; |
| 251 | 249 |
| 252 } // namespace net | 250 } // namespace net |
| 253 | 251 |
| 254 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 252 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
| OLD | NEW |