OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PREF_VALUE_MAP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 virtual ~ExtensionPrefValueMap(); | 65 virtual ~ExtensionPrefValueMap(); |
66 | 66 |
67 // Set an extension preference |value| for |key| of extension |ext_id|. | 67 // Set an extension preference |value| for |key| of extension |ext_id|. |
68 // Takes ownership of |value|. | 68 // Takes ownership of |value|. |
69 // Note that regular extension pref values need to be reported to | 69 // Note that regular extension pref values need to be reported to |
70 // incognito and to regular ExtensionPrefStores. | 70 // incognito and to regular ExtensionPrefStores. |
71 // Precondition: the extension must be registered. | 71 // Precondition: the extension must be registered. |
72 void SetExtensionPref(const std::string& ext_id, | 72 void SetExtensionPref(const std::string& ext_id, |
73 const std::string& key, | 73 const std::string& key, |
74 ExtensionPrefsScope scope, | 74 ExtensionPrefsScope scope, |
75 Value* value); | 75 base::Value* value); |
76 | 76 |
77 // Remove the extension preference value for |key| of extension |ext_id|. | 77 // Remove the extension preference value for |key| of extension |ext_id|. |
78 // Precondition: the extension must be registered. | 78 // Precondition: the extension must be registered. |
79 void RemoveExtensionPref(const std::string& ext_id, | 79 void RemoveExtensionPref(const std::string& ext_id, |
80 const std::string& key, | 80 const std::string& key, |
81 ExtensionPrefsScope scope); | 81 ExtensionPrefsScope scope); |
82 | 82 |
83 // Returns true if currently no extension with higher precedence controls the | 83 // Returns true if currently no extension with higher precedence controls the |
84 // preference. | 84 // preference. |
85 // Note that the this function does does not consider the existence of | 85 // Note that the this function does does not consider the existence of |
(...skipping 29 matching lines...) Expand all Loading... |
115 | 115 |
116 // Hides or makes the extension preference values of the specified extension | 116 // Hides or makes the extension preference values of the specified extension |
117 // visible. | 117 // visible. |
118 void SetExtensionState(const std::string& ext_id, bool is_enabled); | 118 void SetExtensionState(const std::string& ext_id, bool is_enabled); |
119 | 119 |
120 // Adds an observer and notifies it about the currently stored keys. | 120 // Adds an observer and notifies it about the currently stored keys. |
121 void AddObserver(Observer* observer); | 121 void AddObserver(Observer* observer); |
122 | 122 |
123 void RemoveObserver(Observer* observer); | 123 void RemoveObserver(Observer* observer); |
124 | 124 |
125 const Value* GetEffectivePrefValue(const std::string& key, | 125 const base::Value* GetEffectivePrefValue(const std::string& key, |
126 bool incognito, | 126 bool incognito, |
127 bool* from_incognito) const; | 127 bool* from_incognito) const; |
128 | 128 |
129 private: | 129 private: |
130 struct ExtensionEntry; | 130 struct ExtensionEntry; |
131 | 131 |
132 typedef std::map<std::string, ExtensionEntry*> ExtensionEntryMap; | 132 typedef std::map<std::string, ExtensionEntry*> ExtensionEntryMap; |
133 | 133 |
134 const PrefValueMap* GetExtensionPrefValueMap( | 134 const PrefValueMap* GetExtensionPrefValueMap( |
135 const std::string& ext_id, | 135 const std::string& ext_id, |
136 ExtensionPrefsScope scope) const; | 136 ExtensionPrefsScope scope) const; |
137 | 137 |
(...skipping 24 matching lines...) Expand all Loading... |
162 // preferences values (i.e. the ones with the highest precedence) | 162 // preferences values (i.e. the ones with the highest precedence) |
163 // are stored in ExtensionPrefStores. | 163 // are stored in ExtensionPrefStores. |
164 ExtensionEntryMap entries_; | 164 ExtensionEntryMap entries_; |
165 | 165 |
166 ObserverList<Observer, true> observers_; | 166 ObserverList<Observer, true> observers_; |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefValueMap); | 168 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefValueMap); |
169 }; | 169 }; |
170 | 170 |
171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ | 171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ |
OLD | NEW |