| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ |
| 6 #define NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Returns true on success. | 50 // Returns true on success. |
| 51 bool ConvertToDetectedEncoding(const std::string& from, string16* to); | 51 bool ConvertToDetectedEncoding(const std::string& from, string16* to); |
| 52 | 52 |
| 53 // Tries to extract full lines from the raw buffer, converting them to the | 53 // Tries to extract full lines from the raw buffer, converting them to the |
| 54 // detected encoding. Returns network error code. | 54 // detected encoding. Returns network error code. |
| 55 int ExtractFullLinesFromBuffer(); | 55 int ExtractFullLinesFromBuffer(); |
| 56 | 56 |
| 57 // Tries to parse full lines stored in |lines_|. Returns network error code. | 57 // Tries to parse full lines stored in |lines_|. Returns network error code. |
| 58 int ParseLines(); | 58 int ParseLines(); |
| 59 | 59 |
| 60 // Called when we received the entire input. Propagates that info to remaining |
| 61 // parsers. Returns network error code. |
| 62 int OnEndOfInput(); |
| 63 |
| 60 // Detected encoding of the response (empty if unknown or ASCII). | 64 // Detected encoding of the response (empty if unknown or ASCII). |
| 61 std::string encoding_; | 65 std::string encoding_; |
| 62 | 66 |
| 63 // Buffer to keep not-yet-split data. | 67 // Buffer to keep not-yet-split data. |
| 64 std::string buffer_; | 68 std::string buffer_; |
| 65 | 69 |
| 66 // CRLF-delimited lines, without the CRLF, not yet consumed by parser. | 70 // CRLF-delimited lines, without the CRLF, not yet consumed by parser. |
| 67 std::deque<string16> lines_; | 71 std::deque<string16> lines_; |
| 68 | 72 |
| 69 // A collection of parsers for different listing styles. The parsers are owned | 73 // A collection of parsers for different listing styles. The parsers are owned |
| 70 // by this FtpDirectoryListingBuffer. | 74 // by this FtpDirectoryListingBuffer. |
| 71 ParserSet parsers_; | 75 ParserSet parsers_; |
| 72 | 76 |
| 73 // When we're sure about the listing format, its parser is stored in | 77 // When we're sure about the listing format, its parser is stored in |
| 74 // |current_parser_|. | 78 // |current_parser_|. |
| 75 FtpDirectoryListingParser* current_parser_; | 79 FtpDirectoryListingParser* current_parser_; |
| 76 | 80 |
| 77 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingBuffer); | 81 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingBuffer); |
| 78 }; | 82 }; |
| 79 | 83 |
| 80 } // namespace net | 84 } // namespace net |
| 81 | 85 |
| 82 #endif // NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ | 86 #endif // NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ |
| OLD | NEW |