| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ |
| 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/time.h" |
| 10 #include "net/ftp/ftp_directory_listing_parser.h" | 11 #include "net/ftp/ftp_directory_listing_parser.h" |
| 11 | 12 |
| 12 namespace net { | 13 namespace net { |
| 13 | 14 |
| 14 // Parser for Netware-style directory listing. | 15 // Parser for Netware-style directory listing. |
| 15 class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser { | 16 class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser { |
| 16 public: | 17 public: |
| 17 FtpDirectoryListingParserNetware(); | 18 // Constructor. When the current time is needed to guess the year on partial |
| 19 // date strings, |current_time| will be used. This allows passing a specific |
| 20 // date during testing. |
| 21 explicit FtpDirectoryListingParserNetware(const base::Time& current_time); |
| 18 | 22 |
| 19 // FtpDirectoryListingParser methods: | 23 // FtpDirectoryListingParser methods: |
| 20 virtual FtpServerType GetServerType() const { return SERVER_NETWARE; } | 24 virtual FtpServerType GetServerType() const { return SERVER_NETWARE; } |
| 21 virtual bool ConsumeLine(const string16& line); | 25 virtual bool ConsumeLine(const string16& line); |
| 22 virtual bool OnEndOfInput(); | 26 virtual bool OnEndOfInput(); |
| 23 virtual bool EntryAvailable() const; | 27 virtual bool EntryAvailable() const; |
| 24 virtual FtpDirectoryListingEntry PopEntry(); | 28 virtual FtpDirectoryListingEntry PopEntry(); |
| 25 | 29 |
| 26 private: | 30 private: |
| 27 // True after we have received the first line of input. | 31 // True after we have received the first line of input. |
| 28 bool received_first_line_; | 32 bool received_first_line_; |
| 29 | 33 |
| 34 // Store the current time. We need it to correctly parse received dates. |
| 35 const base::Time current_time_; |
| 36 |
| 30 std::queue<FtpDirectoryListingEntry> entries_; | 37 std::queue<FtpDirectoryListingEntry> entries_; |
| 31 | 38 |
| 32 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserNetware); | 39 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserNetware); |
| 33 }; | 40 }; |
| 34 | 41 |
| 35 } // namespace net | 42 } // namespace net |
| 36 | 43 |
| 37 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ | 44 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ |
| OLD | NEW |