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 <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Key names for preferences. | 41 // Key names for preferences. |
42 extern const char kPrefKeyFileSystemId[]; | 42 extern const char kPrefKeyFileSystemId[]; |
43 extern const char kPrefKeyDisplayName[]; | 43 extern const char kPrefKeyDisplayName[]; |
44 extern const char kPrefKeyWritable[]; | 44 extern const char kPrefKeyWritable[]; |
45 extern const char kPrefKeySupportsNotifyTag[]; | 45 extern const char kPrefKeySupportsNotifyTag[]; |
46 | 46 |
47 class ProvidedFileSystemFactoryInterface; | 47 class ProvidedFileSystemFactoryInterface; |
48 class ProvidedFileSystemInfo; | 48 class ProvidedFileSystemInfo; |
49 class ProvidedFileSystemInterface; | 49 class ProvidedFileSystemInterface; |
50 class ServiceFactory; | 50 class ServiceFactory; |
| 51 struct MountOptions; |
51 | 52 |
52 // Registers preferences to remember registered file systems between reboots. | 53 // Registers preferences to remember registered file systems between reboots. |
53 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 54 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
54 | 55 |
55 // Manages and registers the file system provider service. Maintains provided | 56 // Manages and registers the file system provider service. Maintains provided |
56 // file systems. | 57 // file systems. |
57 class Service : public KeyedService, | 58 class Service : public KeyedService, |
58 public extensions::ExtensionRegistryObserver, | 59 public extensions::ExtensionRegistryObserver, |
59 public ProvidedFileSystemObserver { | 60 public ProvidedFileSystemObserver { |
60 public: | 61 public: |
(...skipping 15 matching lines...) Expand all Loading... |
76 void SetFileSystemFactoryForTesting( | 77 void SetFileSystemFactoryForTesting( |
77 const FileSystemFactoryCallback& factory_callback); | 78 const FileSystemFactoryCallback& factory_callback); |
78 | 79 |
79 // Mounts a file system provided by an extension with the |extension_id|. If | 80 // Mounts a file system provided by an extension with the |extension_id|. If |
80 // |writable| is set to true, then the file system is mounted in a R/W mode. | 81 // |writable| is set to true, then the file system is mounted in a R/W mode. |
81 // Otherwise, only read-only operations are supported. If change notification | 82 // Otherwise, only read-only operations are supported. If change notification |
82 // tags are supported, then |supports_notify_tag| must be true. Note, that | 83 // tags are supported, then |supports_notify_tag| must be true. Note, that |
83 // it is required in order to enable the internal cache. For success, returns | 84 // it is required in order to enable the internal cache. For success, returns |
84 // true, otherwise false. | 85 // true, otherwise false. |
85 bool MountFileSystem(const std::string& extension_id, | 86 bool MountFileSystem(const std::string& extension_id, |
86 const std::string& file_system_id, | 87 const MountOptions& options); |
87 const std::string& display_name, | |
88 bool writable, | |
89 bool supports_notify_tag); | |
90 | 88 |
91 // Unmounts a file system with the specified |file_system_id| for the | 89 // Unmounts a file system with the specified |file_system_id| for the |
92 // |extension_id|. For success returns true, otherwise false. | 90 // |extension_id|. For success returns true, otherwise false. |
93 bool UnmountFileSystem(const std::string& extension_id, | 91 bool UnmountFileSystem(const std::string& extension_id, |
94 const std::string& file_system_id, | 92 const std::string& file_system_id, |
95 UnmountReason reason); | 93 UnmountReason reason); |
96 | 94 |
97 // Requests unmounting of the file system. The callback is called when the | 95 // Requests unmounting of the file system. The callback is called when the |
98 // request is accepted or rejected, with an error code. Returns false if the | 96 // request is accepted or rejected, with an error code. Returns false if the |
99 // request could not been created, true otherwise. | 97 // request could not been created, true otherwise. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 base::ThreadChecker thread_checker_; | 178 base::ThreadChecker thread_checker_; |
181 base::WeakPtrFactory<Service> weak_ptr_factory_; | 179 base::WeakPtrFactory<Service> weak_ptr_factory_; |
182 | 180 |
183 DISALLOW_COPY_AND_ASSIGN(Service); | 181 DISALLOW_COPY_AND_ASSIGN(Service); |
184 }; | 182 }; |
185 | 183 |
186 } // namespace file_system_provider | 184 } // namespace file_system_provider |
187 } // namespace chromeos | 185 } // namespace chromeos |
188 | 186 |
189 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ | 187 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ |
OLD | NEW |