| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FtpDirectoryListingParserWindows::~FtpDirectoryListingParserWindows() {} |
| 78 | 78 |
| 79 FtpServerType FtpDirectoryListingParserWindows::GetServerType() const { |
| 80 return SERVER_WINDOWS; |
| 81 } |
| 82 |
| 79 bool FtpDirectoryListingParserWindows::ConsumeLine(const string16& line) { | 83 bool FtpDirectoryListingParserWindows::ConsumeLine(const string16& line) { |
| 80 std::vector<string16> columns; | 84 std::vector<string16> columns; |
| 81 base::SplitString(CollapseWhitespace(line, false), ' ', &columns); | 85 base::SplitString(CollapseWhitespace(line, false), ' ', &columns); |
| 82 | 86 |
| 83 // We may receive file names containing spaces, which can make the number of | 87 // We may receive file names containing spaces, which can make the number of |
| 84 // columns arbitrarily large. We will handle that later. For now just make | 88 // columns arbitrarily large. We will handle that later. For now just make |
| 85 // sure we have all the columns that should normally be there. | 89 // sure we have all the columns that should normally be there. |
| 86 if (columns.size() < 4) | 90 if (columns.size() < 4) |
| 87 return false; | 91 return false; |
| 88 | 92 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 115 return !entries_.empty(); | 119 return !entries_.empty(); |
| 116 } | 120 } |
| 117 | 121 |
| 118 FtpDirectoryListingEntry FtpDirectoryListingParserWindows::PopEntry() { | 122 FtpDirectoryListingEntry FtpDirectoryListingParserWindows::PopEntry() { |
| 119 FtpDirectoryListingEntry entry = entries_.front(); | 123 FtpDirectoryListingEntry entry = entries_.front(); |
| 120 entries_.pop(); | 124 entries_.pop(); |
| 121 return entry; | 125 return entry; |
| 122 } | 126 } |
| 123 | 127 |
| 124 } // namespace net | 128 } // namespace net |
| OLD | NEW |