| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // We don't know the time zone of the server, so just use local time. | 42 // We don't know the time zone of the server, so just use local time. |
| 43 *time = base::Time::FromLocalExploded(time_exploded); | 43 *time = base::Time::FromLocalExploded(time_exploded); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 namespace net { | 49 namespace net { |
| 50 | 50 |
| 51 FtpDirectoryListingParserMlsd::FtpDirectoryListingParserMlsd() { | 51 FtpDirectoryListingParserMlsd::FtpDirectoryListingParserMlsd() {} |
| 52 } | 52 |
| 53 FtpDirectoryListingParserMlsd::~FtpDirectoryListingParserMlsd() {} |
| 53 | 54 |
| 54 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { | 55 bool FtpDirectoryListingParserMlsd::ConsumeLine(const string16& line) { |
| 55 // The first space indicates where the filename begins. | 56 // The first space indicates where the filename begins. |
| 56 string16::size_type first_space_pos = line.find(' '); | 57 string16::size_type first_space_pos = line.find(' '); |
| 57 if (first_space_pos == string16::npos || first_space_pos < 1) | 58 if (first_space_pos == string16::npos || first_space_pos < 1) |
| 58 return false; | 59 return false; |
| 59 | 60 |
| 60 string16 facts_string = line.substr(0, first_space_pos - 1); | 61 string16 facts_string = line.substr(0, first_space_pos - 1); |
| 61 string16 filename = line.substr(first_space_pos + 1); | 62 string16 filename = line.substr(first_space_pos + 1); |
| 62 std::vector<string16> facts_split; | 63 std::vector<string16> facts_split; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 125 } |
| 125 | 126 |
| 126 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { | 127 FtpDirectoryListingEntry FtpDirectoryListingParserMlsd::PopEntry() { |
| 127 DCHECK(EntryAvailable()); | 128 DCHECK(EntryAvailable()); |
| 128 FtpDirectoryListingEntry entry = entries_.front(); | 129 FtpDirectoryListingEntry entry = entries_.front(); |
| 129 entries_.pop(); | 130 entries_.pop(); |
| 130 return entry; | 131 return entry; |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace net | 134 } // namespace net |
| OLD | NEW |