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