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 virtual ~FtpDirectoryListingParserHprc(); | |
26 | |
27 // FtpDirectoryListingParser methods: | |
28 virtual FtpServerType GetServerType() const; | |
29 virtual bool ConsumeLine(const string16& line); | |
30 virtual bool OnEndOfInput(); | |
31 virtual bool EntryAvailable() const; | |
32 virtual FtpDirectoryListingEntry PopEntry(); | |
33 | |
34 private: | |
35 // Store the current time. We use it in place of last modification time | |
36 // that is unknown (the server doesn't send it). | |
37 const base::Time current_time_; | |
38 | |
39 std::queue<FtpDirectoryListingEntry> entries_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserHprc); | |
42 }; | |
43 | |
44 } // namespace net | |
45 | |
46 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_ | |
OLD | NEW |