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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Returns a mutable value for the key (ownership remains with the prefs), | 106 // Returns a mutable value for the key (ownership remains with the prefs), |
107 // if one exists. Otherwise, returns NULL. | 107 // if one exists. Otherwise, returns NULL. |
108 virtual T* Get(); | 108 virtual T* Get(); |
109 | 109 |
110 // Creates and returns a mutable value for the key (the prefs own the new | 110 // Creates and returns a mutable value for the key (the prefs own the new |
111 // value), if one does not already exist. Otherwise, returns the current | 111 // value), if one does not already exist. Otherwise, returns the current |
112 // value. | 112 // value. |
113 virtual T* Create(); | 113 virtual T* Create(); |
114 | 114 |
115 private: | 115 private: |
116 DISALLOW_COPY_AND_ASSIGN(ScopedUpdate); | |
117 | |
118 DictionaryPrefUpdate update_; | 116 DictionaryPrefUpdate update_; |
119 const std::string extension_id_; | 117 const std::string extension_id_; |
120 const std::string key_; | 118 const std::string key_; |
| 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(ScopedUpdate); |
121 }; | 121 }; |
122 typedef ScopedUpdate<base::DictionaryValue, base::Value::TYPE_DICTIONARY> | 122 typedef ScopedUpdate<base::DictionaryValue, base::Value::TYPE_DICTIONARY> |
123 ScopedDictionaryUpdate; | 123 ScopedDictionaryUpdate; |
124 typedef ScopedUpdate<base::ListValue, base::Value::TYPE_LIST> | 124 typedef ScopedUpdate<base::ListValue, base::Value::TYPE_LIST> |
125 ScopedListUpdate; | 125 ScopedListUpdate; |
126 | 126 |
127 // Creates an ExtensionPrefs object. | 127 // Creates an ExtensionPrefs object. |
128 // Does not take ownership of |prefs| or |extension_pref_value_map|. | 128 // Does not take ownership of |prefs| or |extension_pref_value_map|. |
129 // If |extensions_disabled| is true, extension controlled preferences and | 129 // If |extensions_disabled| is true, extension controlled preferences and |
130 // content settings do not become effective. ExtensionPrefsObservers should be | 130 // content settings do not become effective. ExtensionPrefsObservers should be |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 bool extensions_disabled_; | 707 bool extensions_disabled_; |
708 | 708 |
709 ObserverList<ExtensionPrefsObserver> observer_list_; | 709 ObserverList<ExtensionPrefsObserver> observer_list_; |
710 | 710 |
711 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 711 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
712 }; | 712 }; |
713 | 713 |
714 } // namespace extensions | 714 } // namespace extensions |
715 | 715 |
716 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 716 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
OLD | NEW |