| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 | 16 |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class FilePath; | 20 class FilePath; |
| 21 } // namespace base | 21 } // namespace base |
| 22 | 22 |
| 23 namespace storage { | 23 namespace storage { |
| 24 class FileSystemURL; | 24 class FileSystemURL; |
| 25 } // namespace storage | 25 } // namespace storage |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 namespace app_file_handler_util { | 28 namespace app_file_handler_util { |
| 29 | 29 |
| 30 class IsDirectoryCollector { | 30 class IsDirectoryCollector { |
| 31 public: | 31 public: |
| 32 typedef base::Callback<void(scoped_ptr<std::set<base::FilePath>>)> | 32 typedef base::Callback<void(std::unique_ptr<std::set<base::FilePath>>)> |
| 33 CompletionCallback; | 33 CompletionCallback; |
| 34 | 34 |
| 35 explicit IsDirectoryCollector(Profile* profile); | 35 explicit IsDirectoryCollector(Profile* profile); |
| 36 virtual ~IsDirectoryCollector(); | 36 virtual ~IsDirectoryCollector(); |
| 37 | 37 |
| 38 // For the given paths obtains a set with which of them are directories. | 38 // For the given paths obtains a set with which of them are directories. |
| 39 // The collector does not support virtual files if OS != CHROMEOS. | 39 // The collector does not support virtual files if OS != CHROMEOS. |
| 40 void CollectForEntriesPaths(const std::vector<base::FilePath>& paths, | 40 void CollectForEntriesPaths(const std::vector<base::FilePath>& paths, |
| 41 const CompletionCallback& callback); | 41 const CompletionCallback& callback); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void OnIsDirectoryCollected(size_t index, bool directory); | 44 void OnIsDirectoryCollected(size_t index, bool directory); |
| 45 | 45 |
| 46 Profile* profile_; | 46 Profile* profile_; |
| 47 std::vector<base::FilePath> paths_; | 47 std::vector<base::FilePath> paths_; |
| 48 scoped_ptr<std::set<base::FilePath>> result_; | 48 std::unique_ptr<std::set<base::FilePath>> result_; |
| 49 size_t left_; | 49 size_t left_; |
| 50 CompletionCallback callback_; | 50 CompletionCallback callback_; |
| 51 base::WeakPtrFactory<IsDirectoryCollector> weak_ptr_factory_; | 51 base::WeakPtrFactory<IsDirectoryCollector> weak_ptr_factory_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(IsDirectoryCollector); | 53 DISALLOW_COPY_AND_ASSIGN(IsDirectoryCollector); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace app_file_handler_util | 56 } // namespace app_file_handler_util |
| 57 } // namespace extensions | 57 } // namespace extensions |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_ |
| OLD | NEW |