| 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_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // A URLRequestJob subclass that is built on top of FtpTransaction. It | 22 // A URLRequestJob subclass that is built on top of FtpTransaction. It |
| 23 // provides an implementation for FTP. | 23 // provides an implementation for FTP. |
| 24 class URLRequestFtpJob : public URLRequestJob { | 24 class URLRequestFtpJob : public URLRequestJob { |
| 25 public: | 25 public: |
| 26 explicit URLRequestFtpJob(URLRequest* request); | 26 explicit URLRequestFtpJob(URLRequest* request); |
| 27 | 27 |
| 28 static URLRequestJob* Factory(URLRequest* request, | 28 static URLRequestJob* Factory(URLRequest* request, |
| 29 const std::string& scheme); | 29 const std::string& scheme); |
| 30 | 30 |
| 31 // Overridden from URLRequestJob: | 31 // Overridden from URLRequestJob: |
| 32 virtual bool GetMimeType(std::string* mime_type) const; | 32 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 33 virtual HostPortPair GetSocketAddress() const; | 33 virtual HostPortPair GetSocketAddress() const OVERRIDE; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 virtual ~URLRequestFtpJob(); | 36 virtual ~URLRequestFtpJob(); |
| 37 | 37 |
| 38 void StartTransaction(); | 38 void StartTransaction(); |
| 39 | 39 |
| 40 void OnStartCompleted(int result); | 40 void OnStartCompleted(int result); |
| 41 void OnReadCompleted(int result); | 41 void OnReadCompleted(int result); |
| 42 | 42 |
| 43 void RestartTransactionWithAuth(); | 43 void RestartTransactionWithAuth(); |
| 44 | 44 |
| 45 void LogFtpServerType(char server_type); | 45 void LogFtpServerType(char server_type); |
| 46 | 46 |
| 47 // Overridden from URLRequestJob: | 47 // Overridden from URLRequestJob: |
| 48 virtual void Start() OVERRIDE; | 48 virtual void Start() OVERRIDE; |
| 49 virtual void Kill() OVERRIDE; | 49 virtual void Kill() OVERRIDE; |
| 50 virtual LoadState GetLoadState() const OVERRIDE; | 50 virtual LoadState GetLoadState() const OVERRIDE; |
| 51 virtual bool NeedsAuth() OVERRIDE; | 51 virtual bool NeedsAuth() OVERRIDE; |
| 52 virtual void GetAuthChallengeInfo( | 52 virtual void GetAuthChallengeInfo( |
| 53 scoped_refptr<AuthChallengeInfo>* auth_info) OVERRIDE; | 53 scoped_refptr<AuthChallengeInfo>* auth_info) OVERRIDE; |
| 54 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; | 54 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; |
| 55 virtual void CancelAuth() OVERRIDE; | 55 virtual void CancelAuth() OVERRIDE; |
| 56 | 56 |
| 57 // TODO(ibrar): Yet to give another look at this function. | 57 // TODO(ibrar): Yet to give another look at this function. |
| 58 virtual uint64 GetUploadProgress() const; | 58 virtual uint64 GetUploadProgress() const OVERRIDE; |
| 59 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read); | 59 virtual bool ReadRawData(IOBuffer* buf, |
| 60 int buf_size, |
| 61 int *bytes_read) OVERRIDE; |
| 60 | 62 |
| 61 FtpRequestInfo request_info_; | 63 FtpRequestInfo request_info_; |
| 62 scoped_ptr<FtpTransaction> transaction_; | 64 scoped_ptr<FtpTransaction> transaction_; |
| 63 | 65 |
| 64 OldCompletionCallbackImpl<URLRequestFtpJob> start_callback_; | 66 OldCompletionCallbackImpl<URLRequestFtpJob> start_callback_; |
| 65 OldCompletionCallbackImpl<URLRequestFtpJob> read_callback_; | 67 OldCompletionCallbackImpl<URLRequestFtpJob> read_callback_; |
| 66 | 68 |
| 67 bool read_in_progress_; | 69 bool read_in_progress_; |
| 68 | 70 |
| 69 scoped_refptr<AuthData> server_auth_; | 71 scoped_refptr<AuthData> server_auth_; |
| 70 | 72 |
| 71 // Keep a reference to the url request context to be sure it's not deleted | 73 // Keep a reference to the url request context to be sure it's not deleted |
| 72 // before us. | 74 // before us. |
| 73 scoped_refptr<const URLRequestContext> context_; | 75 scoped_refptr<const URLRequestContext> context_; |
| 74 | 76 |
| 75 ScopedRunnableMethodFactory<URLRequestFtpJob> method_factory_; | 77 ScopedRunnableMethodFactory<URLRequestFtpJob> method_factory_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); | 79 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace net | 82 } // namespace net |
| 81 | 83 |
| 82 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 84 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
| OLD | NEW |