| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/directory_lister.h" | 5 #include "net/base/directory_lister.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 FROM_HERE, | 157 FROM_HERE, |
| 158 base::Bind(&DirectoryLister::Core::OnDone, this, ERR_FILE_NOT_FOUND)); | 158 base::Bind(&DirectoryLister::Core::OnDone, this, ERR_FILE_NOT_FOUND)); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 int types = file_util::FileEnumerator::FILES | | 162 int types = file_util::FileEnumerator::FILES | |
| 163 file_util::FileEnumerator::DIRECTORIES; | 163 file_util::FileEnumerator::DIRECTORIES; |
| 164 if (!recursive_) | 164 if (!recursive_) |
| 165 types |= file_util::FileEnumerator::INCLUDE_DOT_DOT; | 165 types |= file_util::FileEnumerator::INCLUDE_DOT_DOT; |
| 166 | 166 |
| 167 file_util::FileEnumerator file_enum(dir_, recursive_, | 167 file_util::FileEnumerator file_enum(dir_, recursive_, types); |
| 168 static_cast<file_util::FileEnumerator::FileType>(types)); | |
| 169 | 168 |
| 170 FilePath path; | 169 FilePath path; |
| 171 std::vector<DirectoryListerData> file_data; | 170 std::vector<DirectoryListerData> file_data; |
| 172 while (lister_ && !(path = file_enum.Next()).empty()) { | 171 while (lister_ && !(path = file_enum.Next()).empty()) { |
| 173 DirectoryListerData data; | 172 DirectoryListerData data; |
| 174 file_enum.GetFindInfo(&data.info); | 173 file_enum.GetFindInfo(&data.info); |
| 175 data.path = path; | 174 data.path = path; |
| 176 file_data.push_back(data); | 175 file_data.push_back(data); |
| 177 | 176 |
| 178 /* TODO(brettw) bug 24107: It would be nice to send incremental updates. | 177 /* TODO(brettw) bug 24107: It would be nice to send incremental updates. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 216 |
| 218 void DirectoryLister::OnReceivedData(const DirectoryListerData& data) { | 217 void DirectoryLister::OnReceivedData(const DirectoryListerData& data) { |
| 219 delegate_->OnListFile(data); | 218 delegate_->OnListFile(data); |
| 220 } | 219 } |
| 221 | 220 |
| 222 void DirectoryLister::OnDone(int error) { | 221 void DirectoryLister::OnDone(int error) { |
| 223 delegate_->OnListDone(error); | 222 delegate_->OnListDone(error); |
| 224 } | 223 } |
| 225 | 224 |
| 226 } // namespace net | 225 } // namespace net |
| OLD | NEW |