| 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 #include "net/ftp/ftp_directory_listing_buffer.h" | 5 #include "net/ftp/ftp_directory_listing_buffer.h" |
| 6 | 6 |
| 7 #include "base/i18n/icu_string_conversions.h" | 7 #include "base/i18n/icu_string_conversions.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return encoding; | 35 return encoding; |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 namespace net { | 40 namespace net { |
| 41 | 41 |
| 42 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer() | 42 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer() |
| 43 : current_parser_(NULL) { | 43 : current_parser_(NULL) { |
| 44 parsers_.insert(new FtpLsDirectoryListingParser()); | 44 parsers_.insert(new FtpLsDirectoryListingParser()); |
| 45 parsers_.insert(new FtpWindowsDirectoryListingParser()); |
| 45 parsers_.insert(new FtpVmsDirectoryListingParser()); | 46 parsers_.insert(new FtpVmsDirectoryListingParser()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() { | 49 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() { |
| 49 STLDeleteElements(&parsers_); | 50 STLDeleteElements(&parsers_); |
| 50 } | 51 } |
| 51 | 52 |
| 52 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) { | 53 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) { |
| 53 buffer_.append(data, data_length); | 54 buffer_.append(data, data_length); |
| 54 | 55 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; | 133 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; |
| 133 if (parsers_.size() == 1) | 134 if (parsers_.size() == 1) |
| 134 current_parser_ = *parsers_.begin(); | 135 current_parser_ = *parsers_.begin(); |
| 135 } | 136 } |
| 136 } | 137 } |
| 137 | 138 |
| 138 return OK; | 139 return OK; |
| 139 } | 140 } |
| 140 | 141 |
| 141 } // namespace net | 142 } // namespace net |
| OLD | NEW |