Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "net/base/auth.h" | 11 #include "net/base/auth.h" |
| 12 #include "net/base/net_export.h" | |
| 12 #include "net/ftp/ftp_request_info.h" | 13 #include "net/ftp/ftp_request_info.h" |
| 13 #include "net/ftp/ftp_transaction.h" | 14 #include "net/ftp/ftp_transaction.h" |
| 14 #include "net/http/http_request_info.h" | 15 #include "net/http/http_request_info.h" |
| 15 #include "net/http/http_transaction.h" | 16 #include "net/http/http_transaction.h" |
| 16 #include "net/proxy/proxy_info.h" | 17 #include "net/proxy/proxy_info.h" |
| 17 #include "net/proxy/proxy_service.h" | 18 #include "net/proxy/proxy_service.h" |
| 18 #include "net/url_request/url_request_job.h" | 19 #include "net/url_request/url_request_job.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 class NetworkDelegate; | 23 class NetworkDelegate; |
| 23 class FtpTransactionFactory; | 24 class FtpTransactionFactory; |
| 24 class FtpAuthCache; | 25 class FtpAuthCache; |
| 25 | 26 |
| 26 // A URLRequestJob subclass that is built on top of FtpTransaction. It | 27 // A URLRequestJob subclass that is built on top of FtpTransaction. It |
| 27 // provides an implementation for FTP. | 28 // provides an implementation for FTP. |
| 28 class URLRequestFtpJob : public URLRequestJob { | 29 class NET_EXPORT_PRIVATE URLRequestFtpJob : public URLRequestJob { |
| 29 public: | 30 public: |
| 30 URLRequestFtpJob(URLRequest* request, | 31 URLRequestFtpJob(URLRequest* request, |
| 31 NetworkDelegate* network_delegate, | 32 NetworkDelegate* network_delegate, |
| 32 FtpTransactionFactory* ftp_transaction_factory, | 33 FtpTransactionFactory* ftp_transaction_factory, |
| 33 FtpAuthCache* ftp_auth_cache); | 34 FtpAuthCache* ftp_auth_cache); |
| 34 | 35 |
| 35 // TODO(shalev): get rid of this function in favor of FtpProtocolHandler. | 36 // TODO(shalev): get rid of this function in favor of FtpProtocolHandler. |
| 36 static URLRequestJob* Factory(URLRequest* request, | 37 static URLRequestJob* Factory(URLRequest* request, |
| 37 NetworkDelegate* network_delegate, | 38 NetworkDelegate* network_delegate, |
| 38 const std::string& scheme); | 39 const std::string& scheme); |
| 39 | 40 |
| 40 // Overridden from URLRequestJob: | 41 // Overridden from URLRequestJob: |
| 41 virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; | 42 virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; |
| 42 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 43 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 43 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; | 44 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; |
| 44 virtual HostPortPair GetSocketAddress() const OVERRIDE; | 45 virtual HostPortPair GetSocketAddress() const OVERRIDE; |
|
mmenke
2013/03/20 17:12:59
While you're here, seems kinda weird that there ar
akalin
2013/03/21 01:30:33
Done.
| |
| 45 | 46 |
| 46 private: | 47 protected: |
| 47 virtual ~URLRequestFtpJob(); | 48 virtual ~URLRequestFtpJob(); |
| 48 | 49 |
| 50 // Overridden from URLRequestJob: | |
| 51 virtual void SetPriority(RequestPriority priority) OVERRIDE; | |
| 52 virtual void Start() OVERRIDE; | |
| 53 virtual void Kill() OVERRIDE; | |
| 54 | |
| 55 RequestPriority priority_; | |
|
mmenke
2013/03/20 17:12:59
optional: Think it's a little better to give this
akalin
2013/03/21 01:30:33
Well, subclasses can just call SetPriority(), but
| |
| 56 | |
| 57 private: | |
| 49 void OnResolveProxyComplete(int result); | 58 void OnResolveProxyComplete(int result); |
| 50 | 59 |
| 51 void StartFtpTransaction(); | 60 void StartFtpTransaction(); |
| 52 void StartHttpTransaction(); | 61 void StartHttpTransaction(); |
| 53 | 62 |
| 54 void OnStartCompleted(int result); | 63 void OnStartCompleted(int result); |
| 55 void OnStartCompletedAsync(int result); | 64 void OnStartCompletedAsync(int result); |
| 56 void OnReadCompleted(int result); | 65 void OnReadCompleted(int result); |
| 57 | 66 |
| 58 void RestartTransactionWithAuth(); | 67 void RestartTransactionWithAuth(); |
| 59 | 68 |
| 60 void LogFtpServerType(char server_type); | 69 void LogFtpServerType(char server_type); |
| 61 | 70 |
| 62 // Overridden from URLRequestJob: | 71 // Overridden from URLRequestJob: |
| 63 virtual void Start() OVERRIDE; | |
| 64 virtual void Kill() OVERRIDE; | |
| 65 virtual LoadState GetLoadState() const OVERRIDE; | 72 virtual LoadState GetLoadState() const OVERRIDE; |
| 66 virtual bool NeedsAuth() OVERRIDE; | 73 virtual bool NeedsAuth() OVERRIDE; |
| 67 virtual void GetAuthChallengeInfo( | 74 virtual void GetAuthChallengeInfo( |
| 68 scoped_refptr<AuthChallengeInfo>* auth_info) OVERRIDE; | 75 scoped_refptr<AuthChallengeInfo>* auth_info) OVERRIDE; |
| 69 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; | 76 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; |
| 70 virtual void CancelAuth() OVERRIDE; | 77 virtual void CancelAuth() OVERRIDE; |
| 71 | 78 |
| 72 // TODO(ibrar): Yet to give another look at this function. | 79 // TODO(ibrar): Yet to give another look at this function. |
| 73 virtual UploadProgress GetUploadProgress() const OVERRIDE; | 80 virtual UploadProgress GetUploadProgress() const OVERRIDE; |
| 74 virtual bool ReadRawData(IOBuffer* buf, | 81 virtual bool ReadRawData(IOBuffer* buf, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 93 | 100 |
| 94 FtpTransactionFactory* ftp_transaction_factory_; | 101 FtpTransactionFactory* ftp_transaction_factory_; |
| 95 FtpAuthCache* ftp_auth_cache_; | 102 FtpAuthCache* ftp_auth_cache_; |
| 96 | 103 |
| 97 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); | 104 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); |
| 98 }; | 105 }; |
| 99 | 106 |
| 100 } // namespace net | 107 } // namespace net |
| 101 | 108 |
| 102 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 109 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
| OLD | NEW |