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 #if !defined(OS_ANDROID) | |
202 for (size_t i = 0; i < arraysize(kPrunedPaths); ++i) { | 203 for (size_t i = 0; i < arraysize(kPrunedPaths); ++i) { |
no sievers
2015/11/23 18:43:40
is this because arraysize(kPrunedPaths) is zero on
mohsen
2015/11/23 21:33:50
Oh, cool. Done.
| |
203 base::FilePath path; | 204 base::FilePath path; |
204 if (PathService::Get(kPrunedPaths[i], &path)) | 205 if (PathService::Get(kPrunedPaths[i], &path)) |
205 pruned_folders_.push_back(path); | 206 pruned_folders_.push_back(path); |
206 } | 207 } |
208 #endif | |
207 | 209 |
208 sequence_checker_.DetachFromSequence(); | 210 sequence_checker_.DetachFromSequence(); |
209 } | 211 } |
210 | 212 |
211 MediaFolderFinder::Worker::~Worker() { | 213 MediaFolderFinder::Worker::~Worker() { |
212 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 214 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
213 } | 215 } |
214 | 216 |
215 MediaFolderFinder::WorkerReply MediaFolderFinder::Worker::ScanFolder( | 217 MediaFolderFinder::WorkerReply MediaFolderFinder::Worker::ScanFolder( |
216 const base::FilePath& path) { | 218 const base::FilePath& path) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 | 437 |
436 if (!IsEmptyScanResult(reply.scan_result)) | 438 if (!IsEmptyScanResult(reply.scan_result)) |
437 results_[path] = reply.scan_result; | 439 results_[path] = reply.scan_result; |
438 | 440 |
439 // Push new folders to the |folders_to_scan_| in reverse order. | 441 // Push new folders to the |folders_to_scan_| in reverse order. |
440 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), | 442 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), |
441 std::back_inserter(folders_to_scan_)); | 443 std::back_inserter(folders_to_scan_)); |
442 | 444 |
443 ScanFolder(); | 445 ScanFolder(); |
444 } | 446 } |
OLD | NEW |