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

Unified Diff: net/ftp/ftp_directory_listing_parser_netware.h

Issue 1120012: Fix the "ls -l" style date parser to correctly guess the year if it is not provided. (Closed)
Patch Set: better comments Created 10 years, 9 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
Index: net/ftp/ftp_directory_listing_parser_netware.h
diff --git a/net/ftp/ftp_directory_listing_parser_netware.h b/net/ftp/ftp_directory_listing_parser_netware.h
index a3b2cef865cfa53bbbc3368a69f0283c682ab26f..aef490aa4b86a7565ab27e182dfa26595b0ebe3a 100644
--- a/net/ftp/ftp_directory_listing_parser_netware.h
+++ b/net/ftp/ftp_directory_listing_parser_netware.h
@@ -7,6 +7,7 @@
#include <queue>
+#include "base/time.h"
#include "net/ftp/ftp_directory_listing_parser.h"
namespace net {
@@ -14,7 +15,10 @@ namespace net {
// Parser for Netware-style directory listing.
class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser {
public:
- FtpDirectoryListingParserNetware();
+ // Constructor. When the current time is needed to guess the year on partial
+ // date strings, |current_time| will be used. This allows passing a specific
+ // date during testing.
+ explicit FtpDirectoryListingParserNetware(const base::Time& current_time);
// FtpDirectoryListingParser methods:
virtual FtpServerType GetServerType() const { return SERVER_NETWARE; }
@@ -27,6 +31,9 @@ class FtpDirectoryListingParserNetware : public FtpDirectoryListingParser {
// True after we have received the first line of input.
bool received_first_line_;
+ // Store the current time. We need it to correctly parse received dates.
+ const base::Time current_time_;
+
std::queue<FtpDirectoryListingEntry> entries_;
DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserNetware);
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_netware.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698