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

Unified Diff: net/ftp/ftp_directory_listing_parser_ls.h

Issue 6670085: FTP: Detect the character encoding only after the entire listing is received. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test coverage Created 9 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
« no previous file with comments | « net/ftp/ftp_directory_listing_parser.cc ('k') | net/ftp/ftp_directory_listing_parser_ls.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_ls.h
diff --git a/net/ftp/ftp_directory_listing_parser_ls.h b/net/ftp/ftp_directory_listing_parser_ls.h
index 49607092973cdcabc7d6a7afa08dd9041b421544..d27bd9194991777c70e3e6d8bd6198f91c827d2c 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.h
+++ b/net/ftp/ftp_directory_listing_parser_ls.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,41 +6,22 @@
#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_
#pragma once
-#include <queue>
+#include <vector>
-#include "base/time.h"
-#include "net/ftp/ftp_directory_listing_parser.h"
+#include "base/string16.h"
+
+namespace base {
+class Time;
+}
namespace net {
-// Parser for "ls -l"-style directory listing.
-class FtpDirectoryListingParserLs : public FtpDirectoryListingParser {
- public:
- // 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 FtpDirectoryListingParserLs(const base::Time& current_time);
- virtual ~FtpDirectoryListingParserLs();
-
- // FtpDirectoryListingParser methods:
- virtual FtpServerType GetServerType() const;
- virtual bool ConsumeLine(const string16& line);
- virtual bool OnEndOfInput();
- virtual bool EntryAvailable() const;
- virtual FtpDirectoryListingEntry PopEntry();
-
- private:
- // True after we have received a "total n" listing header, where n is an
- // integer. Only one such header is allowed per listing.
- bool received_total_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(FtpDirectoryListingParserLs);
-};
+struct FtpDirectoryListingEntry;
+
+// Parses "ls -l" FTP directory listing. Returns true on success.
+bool ParseFtpDirectoryListingLs(const std::vector<string16>& lines,
+ const base::Time& current_time,
+ std::vector<FtpDirectoryListingEntry>* entries);
} // namespace net
« no previous file with comments | « net/ftp/ftp_directory_listing_parser.cc ('k') | net/ftp/ftp_directory_listing_parser_ls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698