| 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_netware.h" | 5 #include "net/ftp/ftp_directory_listing_parser_netware.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 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool FtpDirectoryListingParserNetware::ConsumeLine(const string16& line) { | 43 bool FtpDirectoryListingParserNetware::ConsumeLine(const string16& line) { |
| 44 if (!received_first_line_) { | 44 if (!received_first_line_) { |
| 45 received_first_line_ = true; | 45 received_first_line_ = true; |
| 46 | 46 |
| 47 return StartsWith(line, ASCIIToUTF16("total "), true); | 47 return StartsWith(line, ASCIIToUTF16("total "), true); |
| 48 } | 48 } |
| 49 | 49 |
| 50 std::vector<string16> columns; | 50 std::vector<string16> columns; |
| 51 SplitString(CollapseWhitespace(line, false), ' ', &columns); | 51 base::SplitString(CollapseWhitespace(line, false), ' ', &columns); |
| 52 | 52 |
| 53 if (columns.size() != 8) | 53 if (columns.size() != 8) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 FtpDirectoryListingEntry entry; | 56 FtpDirectoryListingEntry entry; |
| 57 | 57 |
| 58 if (columns[0].length() != 1) | 58 if (columns[0].length() != 1) |
| 59 return false; | 59 return false; |
| 60 if (columns[0][0] == 'd') { | 60 if (columns[0][0] == 'd') { |
| 61 entry.type = FtpDirectoryListingEntry::DIRECTORY; | 61 entry.type = FtpDirectoryListingEntry::DIRECTORY; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return !entries_.empty(); | 98 return !entries_.empty(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 FtpDirectoryListingEntry FtpDirectoryListingParserNetware::PopEntry() { | 101 FtpDirectoryListingEntry FtpDirectoryListingParserNetware::PopEntry() { |
| 102 FtpDirectoryListingEntry entry = entries_.front(); | 102 FtpDirectoryListingEntry entry = entries_.front(); |
| 103 entries_.pop(); | 103 entries_.pop(); |
| 104 return entry; | 104 return entry; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace net | 107 } // namespace net |
| OLD | NEW |