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