| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "net/ftp/ftp_server_type_histograms.h" | 15 #include "net/ftp/ftp_server_type_histograms.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 struct FtpDirectoryListingEntry; | 19 struct FtpDirectoryListingEntry; |
| 20 class FtpDirectoryListingParser; | 20 class FtpDirectoryListingParser; |
| 21 | 21 |
| 22 class FtpDirectoryListingBuffer { | 22 class FtpDirectoryListingBuffer { |
| 23 public: | 23 public: |
| 24 FtpDirectoryListingBuffer(); | 24 // Constructor. When the current time is needed to guess the year on partial |
| 25 | 25 // date strings, |current_time| will be used. This allows passing a specific |
| 26 // date during testing. |
| 27 explicit FtpDirectoryListingBuffer(const base::Time& current_time); |
| 26 ~FtpDirectoryListingBuffer(); | 28 ~FtpDirectoryListingBuffer(); |
| 27 | 29 |
| 28 // Called when data is received from the data socket. Returns network | 30 // Called when data is received from the data socket. Returns network |
| 29 // error code. | 31 // error code. |
| 30 int ConsumeData(const char* data, int data_length); | 32 int ConsumeData(const char* data, int data_length); |
| 31 | 33 |
| 32 // Called when all received data has been consumed by this buffer. Tells the | 34 // Called when all received data has been consumed by this buffer. Tells the |
| 33 // buffer to try to parse remaining raw data and returns network error code. | 35 // buffer to try to parse remaining raw data and returns network error code. |
| 34 int ProcessRemainingData(); | 36 int ProcessRemainingData(); |
| 35 | 37 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // When we're sure about the listing format, its parser is stored in | 79 // When we're sure about the listing format, its parser is stored in |
| 78 // |current_parser_|. | 80 // |current_parser_|. |
| 79 FtpDirectoryListingParser* current_parser_; | 81 FtpDirectoryListingParser* current_parser_; |
| 80 | 82 |
| 81 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingBuffer); | 83 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingBuffer); |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace net | 86 } // namespace net |
| 85 | 87 |
| 86 #endif // NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ | 88 #endif // NET_FTP_FTP_DIRECTORY_LISTING_BUFFER_H_ |
| OLD | NEW |