| 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_windows.h" | 5 #include "net/ftp/ftp_directory_listing_parser_windows.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // We don't know the time zone of the server, so just use local time. | 66 // We don't know the time zone of the server, so just use local time. |
| 67 *time = base::Time::FromLocalExploded(time_exploded); | 67 *time = base::Time::FromLocalExploded(time_exploded); |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 namespace net { | 73 namespace net { |
| 74 | 74 |
| 75 FtpDirectoryListingParserWindows::FtpDirectoryListingParserWindows() { | 75 FtpDirectoryListingParserWindows::FtpDirectoryListingParserWindows() {} |
| 76 } | 76 |
| 77 FtpDirectoryListingParserWindows::~FtpDirectoryListingParserWindows() {} |
| 77 | 78 |
| 78 bool FtpDirectoryListingParserWindows::ConsumeLine(const string16& line) { | 79 bool FtpDirectoryListingParserWindows::ConsumeLine(const string16& line) { |
| 79 std::vector<string16> columns; | 80 std::vector<string16> columns; |
| 80 base::SplitString(CollapseWhitespace(line, false), ' ', &columns); | 81 base::SplitString(CollapseWhitespace(line, false), ' ', &columns); |
| 81 | 82 |
| 82 // We may receive file names containing spaces, which can make the number of | 83 // We may receive file names containing spaces, which can make the number of |
| 83 // columns arbitrarily large. We will handle that later. For now just make | 84 // columns arbitrarily large. We will handle that later. For now just make |
| 84 // sure we have all the columns that should normally be there. | 85 // sure we have all the columns that should normally be there. |
| 85 if (columns.size() < 4) | 86 if (columns.size() < 4) |
| 86 return false; | 87 return false; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 114 return !entries_.empty(); | 115 return !entries_.empty(); |
| 115 } | 116 } |
| 116 | 117 |
| 117 FtpDirectoryListingEntry FtpDirectoryListingParserWindows::PopEntry() { | 118 FtpDirectoryListingEntry FtpDirectoryListingParserWindows::PopEntry() { |
| 118 FtpDirectoryListingEntry entry = entries_.front(); | 119 FtpDirectoryListingEntry entry = entries_.front(); |
| 119 entries_.pop(); | 120 entries_.pop(); |
| 120 return entry; | 121 return entry; |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace net | 124 } // namespace net |
| OLD | NEW |