| Index: net/ftp/ftp_directory_listing_parser.h
|
| diff --git a/net/ftp/ftp_directory_listing_parser.h b/net/ftp/ftp_directory_listing_parser.h
|
| index 637331273ba8348c2913813bbb5fddcb1936d96d..b6c95fe73197a6cc2a50823a9e4bdcf61378893f 100644
|
| --- a/net/ftp/ftp_directory_listing_parser.h
|
| +++ b/net/ftp/ftp_directory_listing_parser.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,10 +6,12 @@
|
| #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_
|
| #pragma once
|
|
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| #include "base/basictypes.h"
|
| #include "base/string16.h"
|
| #include "base/time.h"
|
| -#include "net/ftp/ftp_server_type_histograms.h"
|
|
|
| namespace net {
|
|
|
| @@ -21,33 +23,19 @@ struct FtpDirectoryListingEntry {
|
| };
|
|
|
| Type type;
|
| - string16 name;
|
| + string16 name; // Name (UTF-16-encoded).
|
| + std::string raw_name; // Name in original character encoding.
|
| int64 size; // File size, in bytes. -1 if not applicable.
|
|
|
| // Last modified time, in local time zone.
|
| base::Time last_modified;
|
| };
|
|
|
| -class FtpDirectoryListingParser {
|
| - public:
|
| - virtual ~FtpDirectoryListingParser();
|
| -
|
| - virtual FtpServerType GetServerType() const = 0;
|
| -
|
| - // Adds |line| to the internal parsing buffer. Returns true on success.
|
| - virtual bool ConsumeLine(const string16& line) = 0;
|
| -
|
| - // Called after all input has been consumed. Returns true if the parser
|
| - // recognizes all received data as a valid listing.
|
| - virtual bool OnEndOfInput() = 0;
|
| -
|
| - // Returns true if there is at least one FtpDirectoryListingEntry available.
|
| - virtual bool EntryAvailable() const = 0;
|
| -
|
| - // Returns the next entry. It is an error to call this function unless
|
| - // EntryAvailable returns true.
|
| - virtual FtpDirectoryListingEntry PopEntry() = 0;
|
| -};
|
| +// Parses an FTP directory listing |text|. On success fills in |entries|.
|
| +// Returns network error code.
|
| +int ParseFtpDirectoryListing(const std::string& text,
|
| + const base::Time& current_time,
|
| + std::vector<FtpDirectoryListingEntry>* entries);
|
|
|
| } // namespace net
|
|
|
|
|