Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/url_request/url_request_ftp_job.h" | 5 #include "net/url_request/url_request_ftp_job.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool URLRequestFtpJob::GetMimeType(std::string* mime_type) const { | 47 bool URLRequestFtpJob::GetMimeType(std::string* mime_type) const { |
| 48 if (transaction_->GetResponseInfo()->is_directory_listing) { | 48 if (transaction_->GetResponseInfo()->is_directory_listing) { |
| 49 *mime_type = "text/vnd.chromium.ftp-dir"; | 49 *mime_type = "text/vnd.chromium.ftp-dir"; |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 | 54 |
| 55 std::string URLRequestFtpJob::GetSocketAddress() const { | |
| 56 if (!transaction_.get()) { | |
|
Paweł Hajdan Jr.
2011/02/11 19:34:54
It seems that other methods here assume transactio
Brian Ryner
2011/02/11 23:01:07
I was trying to make sure it was safe to call GetS
| |
| 57 return ""; | |
| 58 } | |
| 59 | |
| 60 const FtpResponseInfo* response_info = transaction_->GetResponseInfo(); | |
| 61 return response_info ? response_info->socket_address : ""; | |
|
Paweł Hajdan Jr.
2011/02/11 19:34:54
Similarly here, do we need to NULL-check?
Brian Ryner
2011/02/11 23:01:07
Here, probably not, it looks like GetResponseInfo(
| |
| 62 } | |
| 63 | |
| 55 URLRequestFtpJob::~URLRequestFtpJob() { | 64 URLRequestFtpJob::~URLRequestFtpJob() { |
| 56 } | 65 } |
| 57 | 66 |
| 58 void URLRequestFtpJob::StartTransaction() { | 67 void URLRequestFtpJob::StartTransaction() { |
| 59 // Create a transaction. | 68 // Create a transaction. |
| 60 DCHECK(!transaction_.get()); | 69 DCHECK(!transaction_.get()); |
| 61 DCHECK(request_->context()); | 70 DCHECK(request_->context()); |
| 62 DCHECK(request_->context()->ftp_transaction_factory()); | 71 DCHECK(request_->context()->ftp_transaction_factory()); |
| 63 | 72 |
| 64 transaction_.reset( | 73 transaction_.reset( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 if (rv == ERR_IO_PENDING) { | 246 if (rv == ERR_IO_PENDING) { |
| 238 read_in_progress_ = true; | 247 read_in_progress_ = true; |
| 239 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 248 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 240 } else { | 249 } else { |
| 241 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 250 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 242 } | 251 } |
| 243 return false; | 252 return false; |
| 244 } | 253 } |
| 245 | 254 |
| 246 } // namespace net | 255 } // namespace net |
| OLD | NEW |