| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "net/ftp/ftp_directory_listing_parser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/i18n/icu_encoding_detection.h" | 9 #include "base/i18n/icu_encoding_detection.h" |
| 10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 base::Bind(&ParseFtpDirectoryListingNetware, | 70 base::Bind(&ParseFtpDirectoryListingNetware, |
| 71 lines, current_time, entries), | 71 lines, current_time, entries), |
| 72 SERVER_NETWARE | 72 SERVER_NETWARE |
| 73 }, | 73 }, |
| 74 { | 74 { |
| 75 base::Bind(&ParseFtpDirectoryListingOS2, lines, entries), | 75 base::Bind(&ParseFtpDirectoryListingOS2, lines, entries), |
| 76 SERVER_OS2 | 76 SERVER_OS2 |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(parsers); i++) { | 80 for (size_t i = 0; i < arraysize(parsers); i++) { |
| 81 entries->clear(); | 81 entries->clear(); |
| 82 if (parsers[i].callback.Run()) { | 82 if (parsers[i].callback.Run()) { |
| 83 *server_type = parsers[i].server_type; | 83 *server_type = parsers[i].server_type; |
| 84 return FillInRawName(encoding, entries); | 84 return FillInRawName(encoding, entries); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 entries->clear(); | 88 entries->clear(); |
| 89 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; | 89 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; |
| 90 } | 90 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 int ParseFtpDirectoryListing(const std::string& text, | 136 int ParseFtpDirectoryListing(const std::string& text, |
| 137 const base::Time& current_time, | 137 const base::Time& current_time, |
| 138 std::vector<FtpDirectoryListingEntry>* entries) { | 138 std::vector<FtpDirectoryListingEntry>* entries) { |
| 139 FtpServerType server_type = SERVER_UNKNOWN; | 139 FtpServerType server_type = SERVER_UNKNOWN; |
| 140 int rv = DecodeAndParse(text, current_time, entries, &server_type); | 140 int rv = DecodeAndParse(text, current_time, entries, &server_type); |
| 141 UpdateFtpServerTypeHistograms(server_type); | 141 UpdateFtpServerTypeHistograms(server_type); |
| 142 return rv; | 142 return rv; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace net | 145 } // namespace net |
| OLD | NEW |