| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_vms.h" | 5 #include "net/ftp/ftp_directory_listing_parser_vms.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 std::vector<base::StringPiece16> time_parts = | 185 std::vector<base::StringPiece16> time_parts = |
| 186 base::SplitStringPiece(time_column, base::ASCIIToUTF16(":"), | 186 base::SplitStringPiece(time_column, base::ASCIIToUTF16(":"), |
| 187 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 187 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 188 if (time_parts.size() != 2) | 188 if (time_parts.size() != 2) |
| 189 return false; | 189 return false; |
| 190 if (!base::StringToInt(time_parts[0], &time_exploded.hour)) | 190 if (!base::StringToInt(time_parts[0], &time_exploded.hour)) |
| 191 return false; | 191 return false; |
| 192 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) | 192 if (!base::StringToInt(time_parts[1], &time_exploded.minute)) |
| 193 return false; | 193 return false; |
| 194 | 194 |
| 195 // We don't know the time zone of the server, so just use local time. | 195 // We don't know the time zone of the server, so just use UTC. |
| 196 *time = base::Time::FromLocalExploded(time_exploded); | 196 *time = base::Time::FromUTCExploded(time_exploded); |
| 197 return true; | 197 return true; |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace | 200 } // namespace |
| 201 | 201 |
| 202 bool ParseFtpDirectoryListingVms( | 202 bool ParseFtpDirectoryListingVms( |
| 203 const std::vector<base::string16>& lines, | 203 const std::vector<base::string16>& lines, |
| 204 std::vector<FtpDirectoryListingEntry>* entries) { | 204 std::vector<FtpDirectoryListingEntry>* entries) { |
| 205 // The first non-empty line is the listing header. It often | 205 // The first non-empty line is the listing header. It often |
| 206 // starts with "Directory ", but not always. We set a flag after | 206 // starts with "Directory ", but not always. We set a flag after |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 entries->push_back(entry); | 295 entries->push_back(entry); |
| 296 } | 296 } |
| 297 | 297 |
| 298 // The only place where we return true is after receiving the "Total" line, | 298 // The only place where we return true is after receiving the "Total" line, |
| 299 // that should be present in every VMS listing. Alternatively, if the listing | 299 // that should be present in every VMS listing. Alternatively, if the listing |
| 300 // contains error messages, it's OK not to have the "Total" line. | 300 // contains error messages, it's OK not to have the "Total" line. |
| 301 return seen_error; | 301 return seen_error; |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace net | 304 } // namespace net |
| OLD | NEW |