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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <utility> | 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/files/file.h" | 14 #include "base/files/file.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "chrome/browser/chromeos/file_system_provider/observer.h" | 22 #include "chrome/browser/chromeos/file_system_provider/observer.h" |
23 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 23 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
24 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 24 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
25 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 25 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/common/extensions/api/file_system_provider.h" | 27 #include "chrome/common/extensions/api/file_system_provider.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry); | 82 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry); |
83 ~Service() override; | 83 ~Service() override; |
84 | 84 |
85 // Sets a custom ProvidedFileSystemInterface factory. Used by unit tests, | 85 // Sets a custom ProvidedFileSystemInterface factory. Used by unit tests, |
86 // where an event router is not available. | 86 // where an event router is not available. |
87 void SetFileSystemFactoryForTesting( | 87 void SetFileSystemFactoryForTesting( |
88 const FileSystemFactoryCallback& factory_callback); | 88 const FileSystemFactoryCallback& factory_callback); |
89 | 89 |
90 // Sets a custom Registry implementation. Used by unit tests. | 90 // Sets a custom Registry implementation. Used by unit tests. |
91 void SetRegistryForTesting(scoped_ptr<RegistryInterface> registry); | 91 void SetRegistryForTesting(std::unique_ptr<RegistryInterface> registry); |
92 | 92 |
93 // Mounts a file system provided by an extension with the |extension_id|. If | 93 // Mounts a file system provided by an extension with the |extension_id|. If |
94 // |writable| is set to true, then the file system is mounted in a R/W mode. | 94 // |writable| is set to true, then the file system is mounted in a R/W mode. |
95 // Otherwise, only read-only operations are supported. If change notification | 95 // Otherwise, only read-only operations are supported. If change notification |
96 // tags are supported, then |supports_notify_tag| must be true. Note, that | 96 // tags are supported, then |supports_notify_tag| must be true. Note, that |
97 // it is required in order to enable the internal cache. For success, returns | 97 // it is required in order to enable the internal cache. For success, returns |
98 // base::File::FILE_OK, otherwise an error code. | 98 // base::File::FILE_OK, otherwise an error code. |
99 base::File::Error MountFileSystem(const std::string& extension_id, | 99 base::File::Error MountFileSystem(const std::string& extension_id, |
100 const MountOptions& options); | 100 const MountOptions& options); |
101 | 101 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Restores from preferences file systems mounted previously by the | 202 // Restores from preferences file systems mounted previously by the |
203 // |extension_id| providing extension. | 203 // |extension_id| providing extension. |
204 void RestoreFileSystems(const std::string& extension_id); | 204 void RestoreFileSystems(const std::string& extension_id); |
205 | 205 |
206 Profile* profile_; | 206 Profile* profile_; |
207 extensions::ExtensionRegistry* extension_registry_; // Not owned. | 207 extensions::ExtensionRegistry* extension_registry_; // Not owned. |
208 FileSystemFactoryCallback file_system_factory_; | 208 FileSystemFactoryCallback file_system_factory_; |
209 base::ObserverList<Observer> observers_; | 209 base::ObserverList<Observer> observers_; |
210 ProvidedFileSystemMap file_system_map_; // Owns pointers. | 210 ProvidedFileSystemMap file_system_map_; // Owns pointers. |
211 MountPointNameToKeyMap mount_point_name_to_key_map_; | 211 MountPointNameToKeyMap mount_point_name_to_key_map_; |
212 scoped_ptr<RegistryInterface> registry_; | 212 std::unique_ptr<RegistryInterface> registry_; |
213 base::ThreadChecker thread_checker_; | 213 base::ThreadChecker thread_checker_; |
214 | 214 |
215 base::WeakPtrFactory<Service> weak_ptr_factory_; | 215 base::WeakPtrFactory<Service> weak_ptr_factory_; |
216 DISALLOW_COPY_AND_ASSIGN(Service); | 216 DISALLOW_COPY_AND_ASSIGN(Service); |
217 }; | 217 }; |
218 | 218 |
219 } // namespace file_system_provider | 219 } // namespace file_system_provider |
220 } // namespace chromeos | 220 } // namespace chromeos |
221 | 221 |
222 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ | 222 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ |
OLD | NEW |