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