Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: net/ftp/ftp_directory_listing_parser_hprc.h

Issue 3448029: FTP: fix directory listing parser for ftp.usa.hp.com (Closed)
Patch Set: attempt to fix Windows trybots Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_buffer_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_hprc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_directory_listing_parser_hprc.h
diff --git a/net/ftp/ftp_directory_listing_parser_hprc.h b/net/ftp/ftp_directory_listing_parser_hprc.h
new file mode 100644
index 0000000000000000000000000000000000000000..73b519537091950cbf7d8a570b2b71a96f3507a4
--- /dev/null
+++ b/net/ftp/ftp_directory_listing_parser_hprc.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_
+#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_
+#pragma once
+
+#include <queue>
+
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "net/ftp/ftp_directory_listing_parser.h"
+
+namespace net {
+
+// Parser for directory listings served by HPRC,
+// see http://hprc.external.hp.com/ and http://crbug.com/56547.
+class FtpDirectoryListingParserHprc : public FtpDirectoryListingParser {
+ public:
+ // Constructor. When we need to provide the last modification time
+ // that we don't know, |current_time| will be used. This allows passing
+ // a specific date during testing.
+ explicit FtpDirectoryListingParserHprc(const base::Time& current_time);
+
+ // FtpDirectoryListingParser methods:
+ virtual FtpServerType GetServerType() const;
+ virtual bool ConsumeLine(const string16& line);
+ virtual bool OnEndOfInput();
+ virtual bool EntryAvailable() const;
+ virtual FtpDirectoryListingEntry PopEntry();
+
+ private:
+ // Store the current time. We use it in place of last modification time
+ // that is unknown (the server doesn't send it).
+ const base::Time current_time_;
+
+ std::queue<FtpDirectoryListingEntry> entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserHprc);
+};
+
+} // namespace net
+
+#endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_HPRC_H_
« no previous file with comments | « net/ftp/ftp_directory_listing_buffer_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_hprc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698