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 21 matching lines...) Expand all Loading... |
32 namespace user_prefs { | 32 namespace user_prefs { |
33 class PrefRegistrySyncable; | 33 class PrefRegistrySyncable; |
34 } // namespace user_prefs | 34 } // namespace user_prefs |
35 | 35 |
36 namespace chromeos { | 36 namespace chromeos { |
37 namespace file_system_provider { | 37 namespace file_system_provider { |
38 | 38 |
39 // Key names for preferences. | 39 // Key names for preferences. |
40 extern const char kPrefKeyFileSystemId[]; | 40 extern const char kPrefKeyFileSystemId[]; |
41 extern const char kPrefKeyDisplayName[]; | 41 extern const char kPrefKeyDisplayName[]; |
| 42 extern const char kPrefKeyWritable[]; |
42 | 43 |
43 class ProvidedFileSystemFactoryInterface; | 44 class ProvidedFileSystemFactoryInterface; |
44 class ProvidedFileSystemInfo; | 45 class ProvidedFileSystemInfo; |
45 class ProvidedFileSystemInterface; | 46 class ProvidedFileSystemInterface; |
46 class ServiceFactory; | 47 class ServiceFactory; |
47 | 48 |
48 // Registers preferences to remember registered file systems between reboots. | 49 // Registers preferences to remember registered file systems between reboots. |
49 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 50 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
50 | 51 |
51 // Manages and registers the file system provider service. Maintains provided | 52 // Manages and registers the file system provider service. Maintains provided |
(...skipping 12 matching lines...) Expand all Loading... |
64 enum UnmountReason { UNMOUNT_REASON_USER, UNMOUNT_REASON_SHUTDOWN }; | 65 enum UnmountReason { UNMOUNT_REASON_USER, UNMOUNT_REASON_SHUTDOWN }; |
65 | 66 |
66 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry); | 67 Service(Profile* profile, extensions::ExtensionRegistry* extension_registry); |
67 virtual ~Service(); | 68 virtual ~Service(); |
68 | 69 |
69 // Sets a custom ProvidedFileSystemInterface factory. Used by unit tests, | 70 // Sets a custom ProvidedFileSystemInterface factory. Used by unit tests, |
70 // where an event router is not available. | 71 // where an event router is not available. |
71 void SetFileSystemFactoryForTesting( | 72 void SetFileSystemFactoryForTesting( |
72 const FileSystemFactoryCallback& factory_callback); | 73 const FileSystemFactoryCallback& factory_callback); |
73 | 74 |
74 // Mounts a file system provided by an extension with the |extension_id|. | 75 // Mounts a file system provided by an extension with the |extension_id|. If |
75 // For success, returns true, otherwise false. | 76 // |writable| is set to true, then the file system is mounted in a R/W mode. |
| 77 // Otherwise, only read-only operations are supported. For success, returns |
| 78 // true, otherwise false. |
76 bool MountFileSystem(const std::string& extension_id, | 79 bool MountFileSystem(const std::string& extension_id, |
77 const std::string& file_system_id, | 80 const std::string& file_system_id, |
78 const std::string& display_name); | 81 const std::string& display_name, |
| 82 bool writable); |
79 | 83 |
80 // Unmounts a file system with the specified |file_system_id| for the | 84 // Unmounts a file system with the specified |file_system_id| for the |
81 // |extension_id|. For success returns true, otherwise false. | 85 // |extension_id|. For success returns true, otherwise false. |
82 bool UnmountFileSystem(const std::string& extension_id, | 86 bool UnmountFileSystem(const std::string& extension_id, |
83 const std::string& file_system_id, | 87 const std::string& file_system_id, |
84 UnmountReason reason); | 88 UnmountReason reason); |
85 | 89 |
86 // Requests unmounting of the file system. The callback is called when the | 90 // Requests unmounting of the file system. The callback is called when the |
87 // request is accepted or rejected, with an error code. Returns false if the | 91 // request is accepted or rejected, with an error code. Returns false if the |
88 // request could not been created, true otherwise. | 92 // request could not been created, true otherwise. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 base::ThreadChecker thread_checker_; | 160 base::ThreadChecker thread_checker_; |
157 base::WeakPtrFactory<Service> weak_ptr_factory_; | 161 base::WeakPtrFactory<Service> weak_ptr_factory_; |
158 | 162 |
159 DISALLOW_COPY_AND_ASSIGN(Service); | 163 DISALLOW_COPY_AND_ASSIGN(Service); |
160 }; | 164 }; |
161 | 165 |
162 } // namespace file_system_provider | 166 } // namespace file_system_provider |
163 } // namespace chromeos | 167 } // namespace chromeos |
164 | 168 |
165 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ | 169 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_H_ |
OLD | NEW |