OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class ExtensionPrefValueMap; | 25 class ExtensionPrefValueMap; |
26 class PrefService; | 26 class PrefService; |
27 class Profile; | 27 class Profile; |
28 | 28 |
29 namespace user_prefs { | 29 namespace user_prefs { |
30 class PrefRegistrySyncable; | 30 class PrefRegistrySyncable; |
31 } | 31 } |
32 | 32 |
33 namespace extensions { | 33 namespace extensions { |
| 34 |
34 class AppSorting; | 35 class AppSorting; |
35 class ContentSettingsStore; | 36 class ContentSettingsStore; |
36 class ExtensionPrefsUninstallExtension; | 37 class ExtensionPrefsUninstallExtension; |
37 class URLPatternSet; | 38 class URLPatternSet; |
38 | 39 |
39 // Class for managing global and per-extension preferences. | 40 // Class for managing global and per-extension preferences. |
40 // | 41 // |
41 // This class distinguishes the following kinds of preferences: | 42 // This class distinguishes the following kinds of preferences: |
42 // - global preferences: | 43 // - global preferences: |
43 // internal state for the extension system in general, not associated | 44 // internal state for the extension system in general, not associated |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 ScopedListUpdate; | 136 ScopedListUpdate; |
136 | 137 |
137 // Creates and initializes an ExtensionPrefs object. | 138 // Creates and initializes an ExtensionPrefs object. |
138 // Does not take ownership of |prefs| and |extension_pref_value_map|. | 139 // Does not take ownership of |prefs| and |extension_pref_value_map|. |
139 // If |extensions_disabled| is true, extension controlled preferences and | 140 // If |extensions_disabled| is true, extension controlled preferences and |
140 // content settings do not become effective. | 141 // content settings do not become effective. |
141 static ExtensionPrefs* Create( | 142 static ExtensionPrefs* Create( |
142 PrefService* prefs, | 143 PrefService* prefs, |
143 const base::FilePath& root_dir, | 144 const base::FilePath& root_dir, |
144 ExtensionPrefValueMap* extension_pref_value_map, | 145 ExtensionPrefValueMap* extension_pref_value_map, |
| 146 scoped_ptr<AppSorting> app_sorting, |
145 bool extensions_disabled); | 147 bool extensions_disabled); |
146 | 148 |
147 // A version of Create which allows injection of a custom base::Time provider. | 149 // A version of Create which allows injection of a custom base::Time provider. |
148 // Use this as needed for testing. | 150 // Use this as needed for testing. |
149 static ExtensionPrefs* Create( | 151 static ExtensionPrefs* Create( |
150 PrefService* prefs, | 152 PrefService* prefs, |
151 const base::FilePath& root_dir, | 153 const base::FilePath& root_dir, |
152 ExtensionPrefValueMap* extension_pref_value_map, | 154 ExtensionPrefValueMap* extension_pref_value_map, |
| 155 scoped_ptr<AppSorting> app_sorting, |
153 bool extensions_disabled, | 156 bool extensions_disabled, |
154 scoped_ptr<TimeProvider> time_provider); | 157 scoped_ptr<TimeProvider> time_provider); |
155 | 158 |
156 virtual ~ExtensionPrefs(); | 159 virtual ~ExtensionPrefs(); |
157 | 160 |
158 // Convenience function to get the ExtensionPrefs for a Profile. | 161 // Convenience function to get the ExtensionPrefs for a Profile. |
159 static ExtensionPrefs* Get(Profile* profile); | 162 static ExtensionPrefs* Get(Profile* profile); |
160 | 163 |
161 // Returns all installed extensions from extension preferences provided by | 164 // Returns all installed extensions from extension preferences provided by |
162 // |pref_service|. This is exposed for ProtectedPrefsWatcher because it needs | 165 // |pref_service|. This is exposed for ProtectedPrefsWatcher because it needs |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 void SetInstallSignature(const DictionaryValue* signature); | 523 void SetInstallSignature(const DictionaryValue* signature); |
521 | 524 |
522 private: | 525 private: |
523 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. | 526 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. |
524 friend class ExtensionPrefsUninstallExtension; // Unit test. | 527 friend class ExtensionPrefsUninstallExtension; // Unit test. |
525 | 528 |
526 // See the Create methods. | 529 // See the Create methods. |
527 ExtensionPrefs(PrefService* prefs, | 530 ExtensionPrefs(PrefService* prefs, |
528 const base::FilePath& root_dir, | 531 const base::FilePath& root_dir, |
529 ExtensionPrefValueMap* extension_pref_value_map, | 532 ExtensionPrefValueMap* extension_pref_value_map, |
| 533 scoped_ptr<AppSorting> app_sorting, |
530 scoped_ptr<TimeProvider> time_provider, | 534 scoped_ptr<TimeProvider> time_provider, |
531 bool extensions_disabled); | 535 bool extensions_disabled); |
532 | 536 |
533 // Converts absolute paths in the pref to paths relative to the | 537 // Converts absolute paths in the pref to paths relative to the |
534 // install_directory_. | 538 // install_directory_. |
535 void MakePathsRelative(); | 539 void MakePathsRelative(); |
536 | 540 |
537 // Converts internal relative paths to be absolute. Used for export to | 541 // Converts internal relative paths to be absolute. Used for export to |
538 // consumers who expect full paths. | 542 // consumers who expect full paths. |
539 void MakePathsAbsolute(base::DictionaryValue* dict); | 543 void MakePathsAbsolute(base::DictionaryValue* dict); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 scoped_ptr<TimeProvider> time_provider_; | 649 scoped_ptr<TimeProvider> time_provider_; |
646 | 650 |
647 bool extensions_disabled_; | 651 bool extensions_disabled_; |
648 | 652 |
649 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 653 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
650 }; | 654 }; |
651 | 655 |
652 } // namespace extensions | 656 } // namespace extensions |
653 | 657 |
654 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 658 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |