| 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_vms.h" | 5 #include "net/ftp/ftp_directory_listing_parser_vms.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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 } // namespace | 162 } // namespace |
| 163 | 163 |
| 164 namespace net { | 164 namespace net { |
| 165 | 165 |
| 166 FtpDirectoryListingParserVms::FtpDirectoryListingParserVms() | 166 FtpDirectoryListingParserVms::FtpDirectoryListingParserVms() |
| 167 : state_(STATE_INITIAL), | 167 : state_(STATE_INITIAL), |
| 168 last_is_directory_(false) { | 168 last_is_directory_(false) { |
| 169 } | 169 } |
| 170 | 170 |
| 171 FtpDirectoryListingParserVms::~FtpDirectoryListingParserVms() {} |
| 172 |
| 171 bool FtpDirectoryListingParserVms::ConsumeLine(const string16& line) { | 173 bool FtpDirectoryListingParserVms::ConsumeLine(const string16& line) { |
| 172 switch (state_) { | 174 switch (state_) { |
| 173 case STATE_INITIAL: | 175 case STATE_INITIAL: |
| 174 DCHECK(last_filename_.empty()); | 176 DCHECK(last_filename_.empty()); |
| 175 if (line.empty()) | 177 if (line.empty()) |
| 176 return true; | 178 return true; |
| 177 if (StartsWith(line, ASCIIToUTF16("Total of "), true)) { | 179 if (StartsWith(line, ASCIIToUTF16("Total of "), true)) { |
| 178 state_ = STATE_END; | 180 state_ = STATE_END; |
| 179 return true; | 181 return true; |
| 180 } | 182 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (entry.type != FtpDirectoryListingEntry::FILE) | 291 if (entry.type != FtpDirectoryListingEntry::FILE) |
| 290 entry.size = -1; | 292 entry.size = -1; |
| 291 if (!VmsDateListingToTime(columns, &entry.last_modified)) | 293 if (!VmsDateListingToTime(columns, &entry.last_modified)) |
| 292 return false; | 294 return false; |
| 293 | 295 |
| 294 entries_.push(entry); | 296 entries_.push(entry); |
| 295 return true; | 297 return true; |
| 296 } | 298 } |
| 297 | 299 |
| 298 } // namespace net | 300 } // namespace net |
| OLD | NEW |