| 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/ftp/ftp_directory_listing_parser_ls.h" | 5 #include "net/ftp/ftp_directory_listing_parser_ls.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 FtpDirectoryListingParserLs::FtpDirectoryListingParserLs( | 85 FtpDirectoryListingParserLs::FtpDirectoryListingParserLs( |
| 86 const base::Time& current_time) | 86 const base::Time& current_time) |
| 87 : received_nonempty_line_(false), | 87 : received_nonempty_line_(false), |
| 88 received_total_line_(false), | 88 received_total_line_(false), |
| 89 current_time_(current_time) { | 89 current_time_(current_time) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 FtpDirectoryListingParserLs::~FtpDirectoryListingParserLs() {} | 92 FtpDirectoryListingParserLs::~FtpDirectoryListingParserLs() {} |
| 93 | 93 |
| 94 FtpServerType FtpDirectoryListingParserLs::GetServerType() const { |
| 95 return SERVER_LS; |
| 96 } |
| 97 |
| 94 bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { | 98 bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { |
| 95 if (line.empty() && !received_nonempty_line_) { | 99 if (line.empty() && !received_nonempty_line_) { |
| 96 // Allow empty lines only at the beginning of the listing. For example VMS | 100 // Allow empty lines only at the beginning of the listing. For example VMS |
| 97 // systems in Unix emulation mode add an empty line before the first listing | 101 // systems in Unix emulation mode add an empty line before the first listing |
| 98 // entry. | 102 // entry. |
| 99 return true; | 103 return true; |
| 100 } | 104 } |
| 101 received_nonempty_line_ = true; | 105 received_nonempty_line_ = true; |
| 102 | 106 |
| 103 std::vector<string16> columns; | 107 std::vector<string16> columns; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return !entries_.empty(); | 210 return !entries_.empty(); |
| 207 } | 211 } |
| 208 | 212 |
| 209 FtpDirectoryListingEntry FtpDirectoryListingParserLs::PopEntry() { | 213 FtpDirectoryListingEntry FtpDirectoryListingParserLs::PopEntry() { |
| 210 FtpDirectoryListingEntry entry = entries_.front(); | 214 FtpDirectoryListingEntry entry = entries_.front(); |
| 211 entries_.pop(); | 215 entries_.pop(); |
| 212 return entry; | 216 return entry; |
| 213 } | 217 } |
| 214 | 218 |
| 215 } // namespace net | 219 } // namespace net |
| OLD | NEW |