[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 5 | #ifndef EXTENSIONS_BROWSER_EXTENSION_PREF_STORE_H_ |
6 | #define EXTENSIONS_BROWSER_EXTENSION_PREF_STORE_H_ | ||||
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 7 | |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 8 | #include <string> |
9 | |||||
[email protected] | 03b9b4e | 2012-10-22 20:01:52 | [diff] [blame] | 10 | #include "base/prefs/value_map_pref_store.h" |
[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 11 | #include "extensions/browser/extension_pref_value_map.h" |
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 12 | |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 13 | // A (non-persistent) PrefStore implementation that holds effective preferences |
14 | // set by extensions. These preferences are managed by and fetched from an | ||||
15 | // ExtensionPrefValueMap. | ||||
16 | class ExtensionPrefStore : public ValueMapPrefStore, | ||||
17 | public ExtensionPrefValueMap::Observer { | ||||
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 18 | public: |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 19 | // Constructs an ExtensionPrefStore for a regular or an incognito profile. |
[email protected] | e7e3803 | 2011-07-26 17:25:25 | [diff] [blame] | 20 | ExtensionPrefStore(ExtensionPrefValueMap* extension_pref_value_map, |
21 | bool incognito_pref_store); | ||||
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 22 | |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 23 | // Overrides for ExtensionPrefValueMap::Observer: |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 24 | void OnInitializationCompleted() override; |
25 | void OnPrefValueChanged(const std::string& key) override; | ||||
26 | void OnExtensionPrefValueMapDestruction() override; | ||||
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 27 | |
[email protected] | 5f2a475 | 2012-04-27 22:18:58 | [diff] [blame] | 28 | protected: |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 29 | ~ExtensionPrefStore() override; |
[email protected] | 5f2a475 | 2012-04-27 22:18:58 | [diff] [blame] | 30 | |
31 | private: | ||||
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 32 | ExtensionPrefValueMap* extension_pref_value_map_; // Weak pointer. |
33 | bool incognito_pref_store_; | ||||
[email protected] | f2d1f61 | 2010-12-09 15:10:17 | [diff] [blame] | 34 | |
35 | DISALLOW_COPY_AND_ASSIGN(ExtensionPrefStore); | ||||
36 | }; | ||||
37 | |||||
[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 38 | #endif // EXTENSIONS_BROWSER_EXTENSION_PREF_STORE_H_ |