| 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_HPRC_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ |
| 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "net/ftp/ftp_directory_listing_parser.h" | 13 #include "net/ftp/ftp_directory_listing_parser.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 // Parser for directory listings served by HPRC, | 17 // Parser for directory listings served by HPRC, |
| 18 // see http://hprc.external.hp.com/ and http://crbug.com/56547. | 18 // see http://hprc.external.hp.com/ and http://crbug.com/56547. |
| 19 class FtpDirectoryListingParserHprc : public FtpDirectoryListingParser { | 19 class FtpDirectoryListingParserHprc : public FtpDirectoryListingParser { |
| 20 public: | 20 public: |
| 21 // Constructor. When we need to provide the last modification time | 21 // Constructor. When we need to provide the last modification time |
| 22 // that we don't know, |current_time| will be used. This allows passing | 22 // that we don't know, |current_time| will be used. This allows passing |
| 23 // a specific date during testing. | 23 // a specific date during testing. |
| 24 explicit FtpDirectoryListingParserHprc(const base::Time& current_time); | 24 explicit FtpDirectoryListingParserHprc(const base::Time& current_time); |
| 25 virtual ~FtpDirectoryListingParserHprc(); |
| 25 | 26 |
| 26 // FtpDirectoryListingParser methods: | 27 // FtpDirectoryListingParser methods: |
| 27 virtual FtpServerType GetServerType() const; | 28 virtual FtpServerType GetServerType() const; |
| 28 virtual bool ConsumeLine(const string16& line); | 29 virtual bool ConsumeLine(const string16& line); |
| 29 virtual bool OnEndOfInput(); | 30 virtual bool OnEndOfInput(); |
| 30 virtual bool EntryAvailable() const; | 31 virtual bool EntryAvailable() const; |
| 31 virtual FtpDirectoryListingEntry PopEntry(); | 32 virtual FtpDirectoryListingEntry PopEntry(); |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 // Store the current time. We use it in place of last modification time | 35 // Store the current time. We use it in place of last modification time |
| 35 // that is unknown (the server doesn't send it). | 36 // that is unknown (the server doesn't send it). |
| 36 const base::Time current_time_; | 37 const base::Time current_time_; |
| 37 | 38 |
| 38 std::queue<FtpDirectoryListingEntry> entries_; | 39 std::queue<FtpDirectoryListingEntry> entries_; |
| 39 | 40 |
| 40 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserHprc); | 41 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserHprc); |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 } // namespace net | 44 } // namespace net |
| 44 | 45 |
| 45 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ | 46 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ |
| OLD | NEW |