| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 namespace net { | 83 namespace net { |
| 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() {} |
| 93 |
| 92 bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { | 94 bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { |
| 93 if (line.empty() && !received_nonempty_line_) { | 95 if (line.empty() && !received_nonempty_line_) { |
| 94 // Allow empty lines only at the beginning of the listing. For example VMS | 96 // Allow empty lines only at the beginning of the listing. For example VMS |
| 95 // systems in Unix emulation mode add an empty line before the first listing | 97 // systems in Unix emulation mode add an empty line before the first listing |
| 96 // entry. | 98 // entry. |
| 97 return true; | 99 return true; |
| 98 } | 100 } |
| 99 received_nonempty_line_ = true; | 101 received_nonempty_line_ = true; |
| 100 | 102 |
| 101 std::vector<string16> columns; | 103 std::vector<string16> columns; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return !entries_.empty(); | 186 return !entries_.empty(); |
| 185 } | 187 } |
| 186 | 188 |
| 187 FtpDirectoryListingEntry FtpDirectoryListingParserLs::PopEntry() { | 189 FtpDirectoryListingEntry FtpDirectoryListingParserLs::PopEntry() { |
| 188 FtpDirectoryListingEntry entry = entries_.front(); | 190 FtpDirectoryListingEntry entry = entries_.front(); |
| 189 entries_.pop(); | 191 entries_.pop(); |
| 190 return entry; | 192 return entry; |
| 191 } | 193 } |
| 192 | 194 |
| 193 } // namespace net | 195 } // namespace net |
| OLD | NEW |