| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // provides an implementation for FTP. | 23 // provides an implementation for FTP. |
| 24 class URLRequestNewFtpJob : public URLRequestJob { | 24 class URLRequestNewFtpJob : public URLRequestJob { |
| 25 public: | 25 public: |
| 26 | 26 |
| 27 explicit URLRequestNewFtpJob(URLRequest* request); | 27 explicit URLRequestNewFtpJob(URLRequest* request); |
| 28 | 28 |
| 29 virtual ~URLRequestNewFtpJob(); | 29 virtual ~URLRequestNewFtpJob(); |
| 30 | 30 |
| 31 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); | 31 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); |
| 32 | 32 |
| 33 // URLRequestJob methods: |
| 34 virtual bool GetMimeType(std::string* mime_type) const; |
| 35 |
| 33 private: | 36 private: |
| 34 // URLRequestJob methods: | 37 // URLRequestJob methods: |
| 35 virtual void Start(); | 38 virtual void Start(); |
| 36 virtual void Kill(); | 39 virtual void Kill(); |
| 37 virtual net::LoadState GetLoadState() const; | 40 virtual net::LoadState GetLoadState() const; |
| 38 virtual bool NeedsAuth(); | 41 virtual bool NeedsAuth(); |
| 39 virtual void GetAuthChallengeInfo( | 42 virtual void GetAuthChallengeInfo( |
| 40 scoped_refptr<net::AuthChallengeInfo>* auth_info); | 43 scoped_refptr<net::AuthChallengeInfo>* auth_info); |
| 41 virtual void SetAuth(const std::wstring& username, | 44 virtual void SetAuth(const std::wstring& username, |
| 42 const std::wstring& password); | 45 const std::wstring& password); |
| 43 virtual void CancelAuth(); | 46 virtual void CancelAuth(); |
| 44 | 47 |
| 45 // TODO(ibrar): Yet to give another look at this function. | 48 // TODO(ibrar): Yet to give another look at this function. |
| 46 virtual uint64 GetUploadProgress() const { return 0; } | 49 virtual uint64 GetUploadProgress() const { return 0; } |
| 47 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 50 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
| 48 | 51 |
| 49 void DestroyTransaction(); | 52 void DestroyTransaction(); |
| 50 void StartTransaction(); | 53 void StartTransaction(); |
| 51 | 54 |
| 52 void OnStartCompleted(int result); | 55 void OnStartCompleted(int result); |
| 53 void OnReadCompleted(int result); | 56 void OnReadCompleted(int result); |
| 54 | 57 |
| 55 void RestartTransactionWithAuth(); | 58 void RestartTransactionWithAuth(); |
| 56 | 59 |
| 57 int ProcessFtpDir(net::IOBuffer *buf, int buf_size, int bytes_read); | |
| 58 | |
| 59 void LogFtpServerType(char server_type); | 60 void LogFtpServerType(char server_type); |
| 60 | 61 |
| 61 net::FtpRequestInfo request_info_; | 62 net::FtpRequestInfo request_info_; |
| 62 scoped_ptr<net::FtpTransaction> transaction_; | 63 scoped_ptr<net::FtpTransaction> transaction_; |
| 63 const net::FtpResponseInfo* response_info_; | |
| 64 | |
| 65 scoped_refptr<net::IOBuffer> dir_listing_buf_; | |
| 66 int dir_listing_buf_size_; | |
| 67 | 64 |
| 68 net::CompletionCallbackImpl<URLRequestNewFtpJob> start_callback_; | 65 net::CompletionCallbackImpl<URLRequestNewFtpJob> start_callback_; |
| 69 net::CompletionCallbackImpl<URLRequestNewFtpJob> read_callback_; | 66 net::CompletionCallbackImpl<URLRequestNewFtpJob> read_callback_; |
| 70 | 67 |
| 71 std::string directory_html_; | |
| 72 bool read_in_progress_; | 68 bool read_in_progress_; |
| 73 std::string encoding_; | |
| 74 | 69 |
| 75 scoped_refptr<net::AuthData> server_auth_; | 70 scoped_refptr<net::AuthData> server_auth_; |
| 76 | 71 |
| 77 // Keep a reference to the url request context to be sure it's not deleted | 72 // Keep a reference to the url request context to be sure it's not deleted |
| 78 // before us. | 73 // before us. |
| 79 scoped_refptr<URLRequestContext> context_; | 74 scoped_refptr<URLRequestContext> context_; |
| 80 | 75 |
| 81 DISALLOW_COPY_AND_ASSIGN(URLRequestNewFtpJob); | 76 DISALLOW_COPY_AND_ASSIGN(URLRequestNewFtpJob); |
| 82 }; | 77 }; |
| 83 | 78 |
| 84 #endif // NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ | 79 #endif // NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ |
| OLD | NEW |