| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "net/ftp/ftp_directory_listing_parser_mlsd.h" | 5 #include "net/ftp/ftp_directory_listing_parser_mlsd.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { | 54 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { |
| 55 // The first space indicates where the filename begins. | 55 // The first space indicates where the filename begins. |
| 56 string16::size_type first_space_pos = line.find(' '); | 56 string16::size_type first_space_pos = line.find(' '); |
| 57 if (first_space_pos == string16::npos || first_space_pos < 1) | 57 if (first_space_pos == string16::npos || first_space_pos < 1) |
| 58 return false; | 58 return false; |
| 59 | 59 |
| 60 string16 facts_string = line.substr(0, first_space_pos - 1); | 60 string16 facts_string = line.substr(0, first_space_pos - 1); |
| 61 string16 filename = line.substr(first_space_pos + 1); | 61 string16 filename = line.substr(first_space_pos + 1); |
| 62 std::vector<string16> facts_split; | 62 std::vector<string16> facts_split; |
| 63 SplitString(facts_string, ';', &facts_split); | 63 base::SplitString(facts_string, ';', &facts_split); |
| 64 | 64 |
| 65 const char* keys[] = { | 65 const char* keys[] = { |
| 66 "modify", | 66 "modify", |
| 67 "size", | 67 "size", |
| 68 "type", | 68 "type", |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 std::map<std::string, string16> facts; | 71 std::map<std::string, string16> facts; |
| 72 for (std::vector<string16>::const_iterator i = facts_split.begin(); | 72 for (std::vector<string16>::const_iterator i = facts_split.begin(); |
| 73 i != facts_split.end(); ++i) { | 73 i != facts_split.end(); ++i) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { | 126 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { |
| 127 DCHECK(EntryAvailable()); | 127 DCHECK(EntryAvailable()); |
| 128 FtpDirectoryListingEntry entry = entries_.front(); | 128 FtpDirectoryListingEntry entry = entries_.front(); |
| 129 entries_.pop(); | 129 entries_.pop(); |
| 130 return entry; | 130 return entry; |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace net | 133 } // namespace net |
| OLD | NEW |