| 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 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
| 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 struct FtpDirectoryListingEntry { | 18 struct FtpDirectoryListingEntry { |
| 19 enum Type { | 19 enum Type { |
| 20 FILE, | 20 FILE, |
| 21 DIRECTORY, | 21 DIRECTORY, |
| 22 SYMLINK, | 22 SYMLINK, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 FtpDirectoryListingEntry(); |
| 26 |
| 25 Type type; | 27 Type type; |
| 26 string16 name; // Name (UTF-16-encoded). | 28 string16 name; // Name (UTF-16-encoded). |
| 27 std::string raw_name; // Name in original character encoding. | 29 std::string raw_name; // Name in original character encoding. |
| 28 int64 size; // File size, in bytes. -1 if not applicable. | 30 int64 size; // File size, in bytes. -1 if not applicable. |
| 29 | 31 |
| 30 // Last modified time, in local time zone. | 32 // Last modified time, in local time zone. |
| 31 base::Time last_modified; | 33 base::Time last_modified; |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 // Parses an FTP directory listing |text|. On success fills in |entries|. | 36 // Parses an FTP directory listing |text|. On success fills in |entries|. |
| 35 // Returns network error code. | 37 // Returns network error code. |
| 36 int ParseFtpDirectoryListing(const std::string& text, | 38 int ParseFtpDirectoryListing(const std::string& text, |
| 37 const base::Time& current_time, | 39 const base::Time& current_time, |
| 38 std::vector<FtpDirectoryListingEntry>* entries); | 40 std::vector<FtpDirectoryListingEntry>* entries); |
| 39 | 41 |
| 40 } // namespace net | 42 } // namespace net |
| 41 | 43 |
| 42 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 44 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
| OLD | NEW |