| 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 #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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "net/ftp/ftp_directory_listing_parser.h" | 12 #include "net/ftp/ftp_directory_listing_parser.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 // Parser for Netware-style directory listing. | 16 // Parser for Netware-style directory listing. |
| 17 class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser { | 17 class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser { |
| 18 public: | 18 public: |
| 19 // Constructor. When the current time is needed to guess the year on partial | 19 // Constructor. When the current time is needed to guess the year on partial |
| 20 // date strings, |current_time| will be used. This allows passing a specific | 20 // date strings, |current_time| will be used. This allows passing a specific |
| 21 // date during testing. | 21 // date during testing. |
| 22 explicit FtpDirectoryListingParserNetware(const base::Time& current_time); | 22 explicit FtpDirectoryListingParserNetware(const base::Time& current_time); |
| 23 virtual ~FtpDirectoryListingParserNetware(); | 23 virtual ~FtpDirectoryListingParserNetware(); |
| 24 | 24 |
| 25 // FtpDirectoryListingParser methods: | 25 // FtpDirectoryListingParser methods: |
| 26 virtual FtpServerType GetServerType() const { return SERVER_NETWARE; } | 26 virtual FtpServerType GetServerType() const; |
| 27 virtual bool ConsumeLine(const string16& line); | 27 virtual bool ConsumeLine(const string16& line); |
| 28 virtual bool OnEndOfInput(); | 28 virtual bool OnEndOfInput(); |
| 29 virtual bool EntryAvailable() const; | 29 virtual bool EntryAvailable() const; |
| 30 virtual FtpDirectoryListingEntry PopEntry(); | 30 virtual FtpDirectoryListingEntry PopEntry(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // True after we have received the first line of input. | 33 // True after we have received the first line of input. |
| 34 bool received_first_line_; | 34 bool received_first_line_; |
| 35 | 35 |
| 36 // Store the current time. We need it to correctly parse received dates. | 36 // Store the current time. We need it to correctly parse received dates. |
| 37 const base::Time current_time_; | 37 const base::Time current_time_; |
| 38 | 38 |
| 39 std::queue<FtpDirectoryListingEntry> entries_; | 39 std::queue<FtpDirectoryListingEntry> entries_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserNetware); | 41 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserNetware); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace net | 44 } // namespace net |
| 45 | 45 |
| 46 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ | 46 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_NETWARE_H_ |
| OLD | NEW |