| 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_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 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 namespace net { | 57 namespace net { |
| 58 | 58 |
| 59 FtpDirectoryListingParserMlsd::FtpDirectoryListingParserMlsd() {} | 59 FtpDirectoryListingParserMlsd::FtpDirectoryListingParserMlsd() {} |
| 60 | 60 |
| 61 FtpDirectoryListingParserMlsd::~FtpDirectoryListingParserMlsd() {} | 61 FtpDirectoryListingParserMlsd::~FtpDirectoryListingParserMlsd() {} |
| 62 | 62 |
| 63 FtpServerType FtpDirectoryListingParserMlsd::GetServerType() const { |
| 64 return SERVER_MLSD; |
| 65 } |
| 66 |
| 63 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { | 67 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { |
| 64 // The first space indicates where the filename begins. | 68 // The first space indicates where the filename begins. |
| 65 string16::size_type first_space_pos = line.find(' '); | 69 string16::size_type first_space_pos = line.find(' '); |
| 66 if (first_space_pos == string16::npos || first_space_pos < 1) | 70 if (first_space_pos == string16::npos || first_space_pos < 1) |
| 67 return false; | 71 return false; |
| 68 | 72 |
| 69 string16 facts_string = line.substr(0, first_space_pos - 1); | 73 string16 facts_string = line.substr(0, first_space_pos - 1); |
| 70 string16 filename = line.substr(first_space_pos + 1); | 74 string16 filename = line.substr(first_space_pos + 1); |
| 71 std::vector<string16> facts_split; | 75 std::vector<string16> facts_split; |
| 72 base::SplitString(facts_string, ';', &facts_split); | 76 base::SplitString(facts_string, ';', &facts_split); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 137 } |
| 134 | 138 |
| 135 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { | 139 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { |
| 136 DCHECK(EntryAvailable()); | 140 DCHECK(EntryAvailable()); |
| 137 FtpDirectoryListingEntry entry = entries_.front(); | 141 FtpDirectoryListingEntry entry = entries_.front(); |
| 138 entries_.pop(); | 142 entries_.pop(); |
| 139 return entry; | 143 return entry; |
| 140 } | 144 } |
| 141 | 145 |
| 142 } // namespace net | 146 } // namespace net |
| OLD | NEW |