| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "net/base/auth.h" | 11 #include "net/base/auth.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/ftp/ftp_request_info.h" |
| 14 #include "net/ftp/ftp_transaction.h" |
| 13 #include "net/url_request/url_request_job.h" | 15 #include "net/url_request/url_request_job.h" |
| 14 | 16 |
| 15 class URLRequestContext; | 17 class URLRequestContext; |
| 16 | 18 |
| 17 // A URLRequestJob subclass that is built on top of FtpTransaction. It | 19 // A URLRequestJob subclass that is built on top of FtpTransaction. It |
| 18 // provides an implementation for FTP. | 20 // provides an implementation for FTP. |
| 19 class URLRequestNewFtpJob : public URLRequestJob { | 21 class URLRequestNewFtpJob : public URLRequestJob { |
| 20 public: | 22 public: |
| 21 | 23 |
| 22 explicit URLRequestNewFtpJob(URLRequest* request); | 24 explicit URLRequestNewFtpJob(URLRequest* request); |
| 23 | 25 |
| 24 virtual ~URLRequestNewFtpJob(); | 26 virtual ~URLRequestNewFtpJob(); |
| 25 | 27 |
| 26 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); | 28 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 // URLRequestJob methods: | 31 // URLRequestJob methods: |
| 30 virtual void Start(); | 32 virtual void Start(); |
| 31 virtual void Kill(); | 33 virtual void Kill(); |
| 32 virtual uint64 GetUploadProgress() const; | 34 |
| 33 virtual void GetResponseInfo(); | 35 // TODO(ibrar): Yet to give another look at this function. |
| 34 virtual int GetResponseCode() const; | 36 virtual uint64 GetUploadProgress() const { return 0; } |
| 35 virtual bool GetMoreData(); | |
| 36 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 37 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
| 37 | 38 |
| 38 void NotifyHeadersComplete(); | 39 void NotifyHeadersComplete(); |
| 39 | 40 |
| 40 void DestroyTransaction(); | 41 void DestroyTransaction(); |
| 41 void StartTransaction(); | 42 void StartTransaction(); |
| 42 | 43 |
| 43 void OnStartCompleted(int result); | 44 void OnStartCompleted(int result); |
| 44 void OnReadCompleted(int result); | 45 void OnReadCompleted(int result); |
| 45 | 46 |
| 47 net::FtpRequestInfo request_info_; |
| 48 scoped_ptr<net::FtpTransaction> transaction_; |
| 49 const net::FtpResponseInfo* response_info_; |
| 50 |
| 46 net::AuthState server_auth_state_; | 51 net::AuthState server_auth_state_; |
| 47 | 52 |
| 48 net::CompletionCallbackImpl<URLRequestNewFtpJob> start_callback_; | 53 net::CompletionCallbackImpl<URLRequestNewFtpJob> start_callback_; |
| 49 net::CompletionCallbackImpl<URLRequestNewFtpJob> read_callback_; | 54 net::CompletionCallbackImpl<URLRequestNewFtpJob> read_callback_; |
| 50 | 55 |
| 56 std::string directory_html_; |
| 51 bool read_in_progress_; | 57 bool read_in_progress_; |
| 52 | 58 |
| 53 // Keep a reference to the url request context to be sure it's not deleted | 59 // Keep a reference to the url request context to be sure it's not deleted |
| 54 // before us. | 60 // before us. |
| 55 scoped_refptr<URLRequestContext> context_; | 61 scoped_refptr<URLRequestContext> context_; |
| 56 | 62 |
| 57 DISALLOW_COPY_AND_ASSIGN(URLRequestNewFtpJob); | 63 DISALLOW_COPY_AND_ASSIGN(URLRequestNewFtpJob); |
| 58 }; | 64 }; |
| 59 | 65 |
| 60 #endif // NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ | 66 #endif // NET_URL_REQUEST_URL_REQUEST_NEW_FTP_JOB_H_ |
| OLD | NEW |