| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // Adds an observer and notifies it about the currently stored keys. | 97 // Adds an observer and notifies it about the currently stored keys. |
| 98 void AddObserver(Observer* observer); | 98 void AddObserver(Observer* observer); |
| 99 | 99 |
| 100 void RemoveObserver(Observer* observer); | 100 void RemoveObserver(Observer* observer); |
| 101 | 101 |
| 102 const Value* GetEffectivePrefValue(const std::string& key, | 102 const Value* GetEffectivePrefValue(const std::string& key, |
| 103 bool incognito) const; | 103 bool incognito) const; |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 struct ExtensionEntry { | 106 struct ExtensionEntry; |
| 107 // Installation time of the extension. | |
| 108 base::Time install_time; | |
| 109 // Whether extension is enabled in the profile. | |
| 110 bool enabled; | |
| 111 // Regular preferences. | |
| 112 PrefValueMap reg_preferences; | |
| 113 // Incognito preferences, empty for regular ExtensionPrefStore. | |
| 114 PrefValueMap inc_preferences; | |
| 115 }; | |
| 116 | 107 |
| 117 typedef std::map<std::string, ExtensionEntry*> ExtensionEntryMap; | 108 typedef std::map<std::string, ExtensionEntry*> ExtensionEntryMap; |
| 118 | 109 |
| 119 const PrefValueMap* GetExtensionPrefValueMap(const std::string& ext_id, | 110 const PrefValueMap* GetExtensionPrefValueMap(const std::string& ext_id, |
| 120 bool incognito) const; | 111 bool incognito) const; |
| 121 | 112 |
| 122 PrefValueMap* GetExtensionPrefValueMap(const std::string& ext_id, | 113 PrefValueMap* GetExtensionPrefValueMap(const std::string& ext_id, |
| 123 bool incognito); | 114 bool incognito); |
| 124 | 115 |
| 125 // Returns all keys of pref values that are set by the extension of |entry|, | 116 // Returns all keys of pref values that are set by the extension of |entry|, |
| 126 // regardless whether they are set for incognito or regular pref values. | 117 // regardless whether they are set for incognito or regular pref values. |
| 127 void GetExtensionControlledKeys(const ExtensionEntry& entry, | 118 void GetExtensionControlledKeys(const ExtensionEntry& entry, |
| 128 std::set<std::string>* out) const; | 119 std::set<std::string>* out) const; |
| 129 | 120 |
| 130 void NotifyOfDestruction(); | 121 void NotifyOfDestruction(); |
| 131 void NotifyPrefValueChanged(const std::string& key); | 122 void NotifyPrefValueChanged(const std::string& key); |
| 132 void NotifyPrefValueChanged(const std::set<std::string>& keys); | 123 void NotifyPrefValueChanged(const std::set<std::string>& keys); |
| 133 | 124 |
| 134 // Mapping of which extension set which preference value. The effective | 125 // Mapping of which extension set which preference value. The effective |
| 135 // preferences values (i.e. the ones with the highest precedence) | 126 // preferences values (i.e. the ones with the highest precedence) |
| 136 // are stored in ExtensionPrefStores. | 127 // are stored in ExtensionPrefStores. |
| 137 ExtensionEntryMap entries_; | 128 ExtensionEntryMap entries_; |
| 138 | 129 |
| 139 ObserverList<Observer, true> observers_; | 130 ObserverList<Observer, true> observers_; |
| 140 | 131 |
| 141 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefValueMap); | 132 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefValueMap); |
| 142 }; | 133 }; |
| 143 | 134 |
| 144 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ | 135 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_VALUE_MAP_H_ |
| OLD | NEW |