| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 base::FilePath path; | 138 base::FilePath path; |
| 139 while (!(path = file_enum.Next()).empty()) { | 139 while (!(path = file_enum.Next()).empty()) { |
| 140 // Abort on cancellation. This is purely for performance reasons. | 140 // Abort on cancellation. This is purely for performance reasons. |
| 141 // Correctness guarantees are made by checks in DoneOnOriginThread. | 141 // Correctness guarantees are made by checks in DoneOnOriginThread. |
| 142 if (IsCancelled()) | 142 if (IsCancelled()) |
| 143 return; | 143 return; |
| 144 | 144 |
| 145 DirectoryListerData data; | 145 DirectoryListerData data; |
| 146 data.info = file_enum.GetInfo(); | 146 data.info = file_enum.GetInfo(); |
| 147 data.path = path; | 147 data.path = path; |
| 148 data.absolute_path = base::MakeAbsoluteFilePath(path); |
| 148 directory_list->push_back(data); | 149 directory_list->push_back(data); |
| 149 | 150 |
| 150 /* TODO(brettw) bug 24107: It would be nice to send incremental updates. | 151 /* TODO(brettw) bug 24107: It would be nice to send incremental updates. |
| 151 We gather them all so they can be sorted, but eventually the sorting | 152 We gather them all so they can be sorted, but eventually the sorting |
| 152 should be done from JS to give more flexibility in the page. When we do | 153 should be done from JS to give more flexibility in the page. When we do |
| 153 that, we can uncomment this to send incremental updates to the page. | 154 that, we can uncomment this to send incremental updates to the page. |
| 154 | 155 |
| 155 const int kFilesPerEvent = 8; | 156 const int kFilesPerEvent = 8; |
| 156 if (file_data.size() < kFilesPerEvent) | 157 if (file_data.size() < kFilesPerEvent) |
| 157 continue; | 158 continue; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 195 |
| 195 void DirectoryLister::OnListFile(const DirectoryListerData& data) { | 196 void DirectoryLister::OnListFile(const DirectoryListerData& data) { |
| 196 delegate_->OnListFile(data); | 197 delegate_->OnListFile(data); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void DirectoryLister::OnListDone(int error) { | 200 void DirectoryLister::OnListDone(int error) { |
| 200 delegate_->OnListDone(error); | 201 delegate_->OnListDone(error); |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace net | 204 } // namespace net |
| OLD | NEW |