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_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REGISTRY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REGISTRY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REGISTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/chromeos/file_system_provider/registry_interface.h" | 11 #include "chrome/browser/chromeos/file_system_provider/registry_interface.h" |
12 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 12 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace user_prefs { | 16 namespace user_prefs { |
17 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
18 } // namespace user_prefs | 18 } // namespace user_prefs |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 namespace file_system_provider { | 21 namespace file_system_provider { |
22 | 22 |
23 // Key names for preferences. | 23 // Key names for preferences. |
24 extern const char kPrefKeyFileSystemId[]; | 24 extern const char kPrefKeyFileSystemId[]; |
25 extern const char kPrefKeyDisplayName[]; | 25 extern const char kPrefKeyDisplayName[]; |
26 extern const char kPrefKeyWritable[]; | 26 extern const char kPrefKeyWritable[]; |
| 27 extern const char kPrefKeySource[]; |
27 extern const char kPrefKeySupportsNotifyTag[]; | 28 extern const char kPrefKeySupportsNotifyTag[]; |
28 extern const char kPrefKeyWatchers[]; | 29 extern const char kPrefKeyWatchers[]; |
29 extern const char kPrefKeyWatcherEntryPath[]; | 30 extern const char kPrefKeyWatcherEntryPath[]; |
30 extern const char kPrefKeyWatcherRecursive[]; | 31 extern const char kPrefKeyWatcherRecursive[]; |
31 extern const char kPrefKeyWatcherPersistentOrigins[]; | 32 extern const char kPrefKeyWatcherPersistentOrigins[]; |
32 extern const char kPrefKeyWatcherLastTag[]; | 33 extern const char kPrefKeyWatcherLastTag[]; |
33 extern const char kPrefKeyOpenedFilesLimit[]; | 34 extern const char kPrefKeyOpenedFilesLimit[]; |
34 | 35 |
35 class ProvidedFileSystemInfo; | 36 class ProvidedFileSystemInfo; |
36 | 37 |
37 // Registers preferences to remember registered file systems between reboots. | 38 // Registers preferences to remember registered file systems between reboots. |
38 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 39 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
39 | 40 |
| 41 // Converts a file system's data source value back and forth between Source and |
| 42 // std::string types. |
| 43 std::string SourceToString(Source source); |
| 44 bool StringToSource(const std::string& source, Source* result); |
| 45 |
40 // Remembers and restores file systems in a persistent storage. | 46 // Remembers and restores file systems in a persistent storage. |
41 class Registry : public RegistryInterface { | 47 class Registry : public RegistryInterface { |
42 public: | 48 public: |
43 explicit Registry(Profile* profile); | 49 explicit Registry(Profile* profile); |
44 ~Registry() override; | 50 ~Registry() override; |
45 | 51 |
46 // RegistryInterface overrides. | 52 // RegistryInterface overrides. |
47 void RememberFileSystem(const ProvidedFileSystemInfo& file_system_info, | 53 void RememberFileSystem(const ProvidedFileSystemInfo& file_system_info, |
48 const Watchers& watchers) override; | 54 const Watchers& watchers) override; |
49 void ForgetFileSystem(const std::string& extension_id, | 55 void ForgetFileSystem(const std::string& extension_id, |
50 const std::string& file_system_id) override; | 56 const std::string& file_system_id) override; |
51 scoped_ptr<RestoredFileSystems> RestoreFileSystems( | 57 scoped_ptr<RestoredFileSystems> RestoreFileSystems( |
52 const std::string& extension_id) override; | 58 const std::string& extension_id) override; |
53 void UpdateWatcherTag(const ProvidedFileSystemInfo& file_system_info, | 59 void UpdateWatcherTag(const ProvidedFileSystemInfo& file_system_info, |
54 const Watcher& watcher) override; | 60 const Watcher& watcher) override; |
55 | 61 |
56 private: | 62 private: |
57 Profile* profile_; // Not owned. | 63 Profile* profile_; // Not owned. |
58 DISALLOW_COPY_AND_ASSIGN(Registry); | 64 DISALLOW_COPY_AND_ASSIGN(Registry); |
59 }; | 65 }; |
60 | 66 |
61 } // namespace file_system_provider | 67 } // namespace file_system_provider |
62 } // namespace chromeos | 68 } // namespace chromeos |
63 | 69 |
64 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REGISTRY_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REGISTRY_H_ |
OLD | NEW |