OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/media_galleries/media_folder_finder.h" | 5 #include "chrome/browser/media_galleries/media_folder_finder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 DISALLOW_COPY_AND_ASSIGN(Worker); | 192 DISALLOW_COPY_AND_ASSIGN(Worker); |
193 }; | 193 }; |
194 | 194 |
195 MediaFolderFinder::Worker::Worker( | 195 MediaFolderFinder::Worker::Worker( |
196 const std::vector<base::FilePath>& graylisted_folders) | 196 const std::vector<base::FilePath>& graylisted_folders) |
197 : folder_paths_are_absolute_(false), | 197 : folder_paths_are_absolute_(false), |
198 graylisted_folders_(graylisted_folders), | 198 graylisted_folders_(graylisted_folders), |
199 filter_(new MediaPathFilter) { | 199 filter_(new MediaPathFilter) { |
200 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 200 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
201 | 201 |
| 202 // TODO(mfomitchev): no entries in kPrunedPaths on Android. |
| 203 // What should we do? |
| 204 #if !defined(OS_ANDROID) |
202 for (size_t i = 0; i < arraysize(kPrunedPaths); ++i) { | 205 for (size_t i = 0; i < arraysize(kPrunedPaths); ++i) { |
203 base::FilePath path; | 206 base::FilePath path; |
204 if (PathService::Get(kPrunedPaths[i], &path)) | 207 if (PathService::Get(kPrunedPaths[i], &path)) |
205 pruned_folders_.push_back(path); | 208 pruned_folders_.push_back(path); |
206 } | 209 } |
| 210 #endif |
207 | 211 |
208 sequence_checker_.DetachFromSequence(); | 212 sequence_checker_.DetachFromSequence(); |
209 } | 213 } |
210 | 214 |
211 MediaFolderFinder::Worker::~Worker() { | 215 MediaFolderFinder::Worker::~Worker() { |
212 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 216 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
213 } | 217 } |
214 | 218 |
215 MediaFolderFinder::WorkerReply MediaFolderFinder::Worker::ScanFolder( | 219 MediaFolderFinder::WorkerReply MediaFolderFinder::Worker::ScanFolder( |
216 const base::FilePath& path) { | 220 const base::FilePath& path) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 439 |
436 if (!IsEmptyScanResult(reply.scan_result)) | 440 if (!IsEmptyScanResult(reply.scan_result)) |
437 results_[path] = reply.scan_result; | 441 results_[path] = reply.scan_result; |
438 | 442 |
439 // Push new folders to the |folders_to_scan_| in reverse order. | 443 // Push new folders to the |folders_to_scan_| in reverse order. |
440 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), | 444 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), |
441 std::back_inserter(folders_to_scan_)); | 445 std::back_inserter(folders_to_scan_)); |
442 | 446 |
443 ScanFolder(); | 447 ScanFolder(); |
444 } | 448 } |
OLD | NEW |