| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() {} | 171 FtpDirectoryListingParserVms::~FtpDirectoryListingParserVms() {} |
| 172 | 172 |
| 173 FtpServerType FtpDirectoryListingParserVms::GetServerType() const { |
| 174 return SERVER_VMS; |
| 175 } |
| 176 |
| 173 bool FtpDirectoryListingParserVms::ConsumeLine(const string16& line) { | 177 bool FtpDirectoryListingParserVms::ConsumeLine(const string16& line) { |
| 174 switch (state_) { | 178 switch (state_) { |
| 175 case STATE_INITIAL: | 179 case STATE_INITIAL: |
| 176 DCHECK(last_filename_.empty()); | 180 DCHECK(last_filename_.empty()); |
| 177 if (line.empty()) | 181 if (line.empty()) |
| 178 return true; | 182 return true; |
| 179 if (StartsWith(line, ASCIIToUTF16("Total of "), true)) { | 183 if (StartsWith(line, ASCIIToUTF16("Total of "), true)) { |
| 180 state_ = STATE_END; | 184 state_ = STATE_END; |
| 181 return true; | 185 return true; |
| 182 } | 186 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (entry.type != FtpDirectoryListingEntry::FILE) | 295 if (entry.type != FtpDirectoryListingEntry::FILE) |
| 292 entry.size = -1; | 296 entry.size = -1; |
| 293 if (!VmsDateListingToTime(columns, &entry.last_modified)) | 297 if (!VmsDateListingToTime(columns, &entry.last_modified)) |
| 294 return false; | 298 return false; |
| 295 | 299 |
| 296 entries_.push(entry); | 300 entries_.push(entry); |
| 297 return true; | 301 return true; |
| 298 } | 302 } |
| 299 | 303 |
| 300 } // namespace net | 304 } // namespace net |
| OLD | NEW |