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