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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "net/base/auth.h" | 12 #include "net/base/auth.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/ftp/ftp_request_info.h" | 14 #include "net/ftp/ftp_request_info.h" |
| 15 #include "net/ftp/ftp_transaction.h" | 15 #include "net/ftp/ftp_transaction.h" |
| 16 #include "net/url_request/url_request_job.h" | 16 #include "net/url_request/url_request_job.h" |
| 17 | 17 |
|
Paweł Hajdan Jr.
2012/06/07 19:30:21
nit: Why an empty line? Keep things sorted and for
shalev
2012/06/21 20:04:55
Done.
| |
| 18 #include "net/url_request/url_request_job_factory.h" | |
| 19 #include "net/base/network_delegate.h" | |
|
erikwright (departed)
2012/06/07 19:14:51
presumably these includes are no longer required h
shalev
2012/06/21 20:04:55
Done.
| |
| 20 #include "net/ftp/ftp_transaction_factory.h" | |
| 21 #include "net/ftp/ftp_auth_cache.h" | |
| 22 | |
| 18 namespace net { | 23 namespace net { |
| 19 | 24 |
| 20 class URLRequestContext; | 25 class URLRequestContext; |
| 21 | 26 |
| 22 // A URLRequestJob subclass that is built on top of FtpTransaction. It | 27 // A URLRequestJob subclass that is built on top of FtpTransaction. It |
| 23 // provides an implementation for FTP. | 28 // provides an implementation for FTP. |
| 24 class URLRequestFtpJob : public URLRequestJob { | 29 class URLRequestFtpJob : public URLRequestJob { |
| 25 public: | 30 public: |
| 26 explicit URLRequestFtpJob(URLRequest* request); | 31 URLRequestFtpJob(URLRequest* request, |
| 32 NetworkDelegate* network_delegate, | |
| 33 FtpTransactionFactory* ftp_transaction_factory, | |
| 34 FtpAuthCache* ftp_auth_cache); | |
| 27 | 35 |
| 28 static URLRequestJob* Factory(URLRequest* request, | 36 static URLRequestJob* Factory(URLRequest* request, |
| 29 const std::string& scheme); | 37 const std::string& scheme); |
| 30 | 38 |
| 31 // Overridden from URLRequestJob: | 39 // Overridden from URLRequestJob: |
| 32 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 40 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 33 virtual HostPortPair GetSocketAddress() const OVERRIDE; | 41 virtual HostPortPair GetSocketAddress() const OVERRIDE; |
| 42 NetworkDelegate* network_delegate() const { return network_delegate_; } | |
| 43 FtpTransactionFactory* ftp_transaction_factory() { | |
|
erikwright (departed)
2012/06/07 19:14:51
Why are these accessors added?
Paweł Hajdan Jr.
2012/06/07 19:30:21
Yup, they really shouldn't be needed.
shalev
2012/06/21 20:04:55
Done.
| |
| 44 return ftp_transaction_factory_; | |
| 45 } | |
| 46 FtpAuthCache* ftp_auth_cache() { return ftp_auth_cache_; } | |
| 34 | 47 |
| 35 private: | 48 private: |
| 36 virtual ~URLRequestFtpJob(); | 49 virtual ~URLRequestFtpJob(); |
| 37 | 50 |
| 38 void StartTransaction(); | 51 void StartTransaction(); |
| 39 | 52 |
| 40 void OnStartCompleted(int result); | 53 void OnStartCompleted(int result); |
| 41 void OnReadCompleted(int result); | 54 void OnReadCompleted(int result); |
| 42 | 55 |
| 43 void RestartTransactionWithAuth(); | 56 void RestartTransactionWithAuth(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 62 | 75 |
| 63 FtpRequestInfo request_info_; | 76 FtpRequestInfo request_info_; |
| 64 scoped_ptr<FtpTransaction> transaction_; | 77 scoped_ptr<FtpTransaction> transaction_; |
| 65 | 78 |
| 66 bool read_in_progress_; | 79 bool read_in_progress_; |
| 67 | 80 |
| 68 scoped_refptr<AuthData> server_auth_; | 81 scoped_refptr<AuthData> server_auth_; |
| 69 | 82 |
| 70 base::WeakPtrFactory<URLRequestFtpJob> weak_factory_; | 83 base::WeakPtrFactory<URLRequestFtpJob> weak_factory_; |
| 71 | 84 |
| 72 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); | 85 DISALLOW_COPY_AND_ASSIGN(URLRequestFtpJob); |
|
erikwright (departed)
2012/06/07 19:14:51
DISALLOW_... should be the last line in the privat
shalev
2012/06/21 20:04:55
Done.
| |
| 86 | |
| 87 NetworkDelegate* network_delegate_; | |
| 88 FtpTransactionFactory* ftp_transaction_factory_; | |
| 89 FtpAuthCache* ftp_auth_cache_; | |
| 73 }; | 90 }; |
| 74 | 91 |
| 75 } // namespace net | 92 } // namespace net |
| 76 | 93 |
| 77 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 94 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
| OLD | NEW |