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

Unified Diff: net/ftp/ftp_directory_listing_parser_vms.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_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_vms.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_vms.h
diff --git a/net/ftp/ftp_directory_listing_parser_vms.h b/net/ftp/ftp_directory_listing_parser_vms.h
index 6f7fb73a4452b97c7c3a19ea13e04141007cda95..8986fcb68bee1abcd44d9f977e050fe8b281d24a 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.h
+++ b/net/ftp/ftp_directory_listing_parser_vms.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,60 +6,18 @@
#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_VMS_H_
#pragma once
-#include <queue>
+#include <vector>
-#include "net/ftp/ftp_directory_listing_parser.h"
+#include "base/string16.h"
namespace net {
-// Parser for VMS-style directory listing (including variants).
-class FtpDirectoryListingParserVms : public FtpDirectoryListingParser {
- public:
- FtpDirectoryListingParserVms();
- virtual ~FtpDirectoryListingParserVms();
+struct FtpDirectoryListingEntry;
- // FtpDirectoryListingParser methods:
- virtual FtpServerType GetServerType() const;
- virtual bool ConsumeLine(const string16& line);
- virtual bool OnEndOfInput();
- virtual bool EntryAvailable() const;
- virtual FtpDirectoryListingEntry PopEntry();
-
- private:
- enum State {
- STATE_INITIAL,
-
- // Indicates that we have received the header, like this:
- // Directory SYS$SYSDEVICE:[ANONYMOUS]
- STATE_RECEIVED_HEADER,
-
- // Indicates that we have received the first listing entry, like this:
- // MADGOAT.DIR;1 2 9-MAY-2001 22:23:44.85
- STATE_ENTRIES,
-
- // Indicates that we have received the last listing entry.
- STATE_RECEIVED_LAST_ENTRY,
-
- // Indicates that we have successfully received all parts of the listing.
- STATE_END,
- };
-
- // Consumes listing line which is expected to be a directory listing entry
- // (and not a comment etc). Returns true on success.
- bool ConsumeEntryLine(const string16& line);
-
- State state_;
-
- // VMS can use two physical lines if the filename is long. The first line will
- // contain the filename, and the second line everything else. Store the
- // filename until we receive the next line.
- string16 last_filename_;
- bool last_is_directory_;
-
- std::queue<FtpDirectoryListingEntry> entries_;
-
- DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserVms);
-};
+// Parses VMS FTP directory listing. Returns true on success.
+bool ParseFtpDirectoryListingVms(
+ const std::vector<string16>& lines,
+ std::vector<FtpDirectoryListingEntry>* entries);
} // namespace net
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_vms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698