| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "net/ftp/ftp_directory_listing_buffer.h" | 5 #include "net/ftp/ftp_directory_listing_buffer.h" |
| 6 | 6 |
| 7 #include "base/i18n/icu_string_conversions.h" | 7 #include "base/i18n/icu_string_conversions.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // assigned by ICU and it's hard to come up with a lower limit. | 36 // assigned by ICU and it's hard to come up with a lower limit. |
| 37 if (U_FAILURE(status)) | 37 if (U_FAILURE(status)) |
| 38 return std::string(); | 38 return std::string(); |
| 39 return encoding; | 39 return encoding; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 namespace net { | 44 namespace net { |
| 45 | 45 |
| 46 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer() | 46 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer( |
| 47 const base::Time& current_time) |
| 47 : current_parser_(NULL) { | 48 : current_parser_(NULL) { |
| 48 parsers_.insert(new FtpDirectoryListingParserLs()); | 49 parsers_.insert(new FtpDirectoryListingParserLs(current_time)); |
| 49 parsers_.insert(new FtpDirectoryListingParserMlsd()); | 50 parsers_.insert(new FtpDirectoryListingParserMlsd()); |
| 50 parsers_.insert(new FtpDirectoryListingParserNetware()); | 51 parsers_.insert(new FtpDirectoryListingParserNetware(current_time)); |
| 51 parsers_.insert(new FtpDirectoryListingParserVms()); | 52 parsers_.insert(new FtpDirectoryListingParserVms()); |
| 52 parsers_.insert(new FtpDirectoryListingParserWindows()); | 53 parsers_.insert(new FtpDirectoryListingParserWindows()); |
| 53 } | 54 } |
| 54 | 55 |
| 55 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() { | 56 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() { |
| 56 STLDeleteElements(&parsers_); | 57 STLDeleteElements(&parsers_); |
| 57 } | 58 } |
| 58 | 59 |
| 59 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) { | 60 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) { |
| 60 buffer_.append(data, data_length); | 61 buffer_.append(data, data_length); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return OK; | 186 return OK; |
| 186 | 187 |
| 187 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; | 188 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; |
| 188 } | 189 } |
| 189 | 190 |
| 190 current_parser_ = *parsers_.begin(); | 191 current_parser_ = *parsers_.begin(); |
| 191 return OK; | 192 return OK; |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace net | 195 } // namespace net |
| OLD | NEW |