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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 base::FilePath platform_root = GetPlatformSpecificDefaultScanRoot(); | 164 base::FilePath platform_root = GetPlatformSpecificDefaultScanRoot(); |
165 if (!platform_root.empty()) | 165 if (!platform_root.empty()) |
166 roots.push_back(platform_root); | 166 roots.push_back(platform_root); |
167 callback.Run(roots); | 167 callback.Run(roots); |
168 } | 168 } |
169 | 169 |
170 } // namespace | 170 } // namespace |
171 | 171 |
172 MediaFolderFinder::WorkerReply::WorkerReply() {} | 172 MediaFolderFinder::WorkerReply::WorkerReply() {} |
173 | 173 |
| 174 MediaFolderFinder::WorkerReply::WorkerReply(const WorkerReply& other) = default; |
| 175 |
174 MediaFolderFinder::WorkerReply::~WorkerReply() {} | 176 MediaFolderFinder::WorkerReply::~WorkerReply() {} |
175 | 177 |
176 // The Worker is created on the UI thread, but does all its work on a blocking | 178 // The Worker is created on the UI thread, but does all its work on a blocking |
177 // SequencedTaskRunner. | 179 // SequencedTaskRunner. |
178 class MediaFolderFinder::Worker { | 180 class MediaFolderFinder::Worker { |
179 public: | 181 public: |
180 explicit Worker(const std::vector<base::FilePath>& graylisted_folders); | 182 explicit Worker(const std::vector<base::FilePath>& graylisted_folders); |
181 ~Worker(); | 183 ~Worker(); |
182 | 184 |
183 // Scans |path| and return the results. | 185 // Scans |path| and return the results. |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 442 |
441 if (!IsEmptyScanResult(reply.scan_result)) | 443 if (!IsEmptyScanResult(reply.scan_result)) |
442 results_[path] = reply.scan_result; | 444 results_[path] = reply.scan_result; |
443 | 445 |
444 // Push new folders to the |folders_to_scan_| in reverse order. | 446 // Push new folders to the |folders_to_scan_| in reverse order. |
445 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), | 447 std::copy(reply.new_folders.rbegin(), reply.new_folders.rend(), |
446 std::back_inserter(folders_to_scan_)); | 448 std::back_inserter(folders_to_scan_)); |
447 | 449 |
448 ScanFolder(); | 450 ScanFolder(); |
449 } | 451 } |
OLD | NEW |