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_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time.h" | |
11 #include "chrome/browser/extensions/extension_pref_value_map.h" | 10 #include "chrome/browser/extensions/extension_pref_value_map.h" |
12 #include "chrome/browser/prefs/value_map_pref_store.h" | 11 #include "chrome/browser/prefs/value_map_pref_store.h" |
13 | 12 |
14 // A (non-persistent) PrefStore implementation that holds effective preferences | 13 // A (non-persistent) PrefStore implementation that holds effective preferences |
15 // set by extensions. These preferences are managed by and fetched from an | 14 // set by extensions. These preferences are managed by and fetched from an |
16 // ExtensionPrefValueMap. | 15 // ExtensionPrefValueMap. |
17 class ExtensionPrefStore : public ValueMapPrefStore, | 16 class ExtensionPrefStore : public ValueMapPrefStore, |
18 public ExtensionPrefValueMap::Observer { | 17 public ExtensionPrefValueMap::Observer { |
19 public: | 18 public: |
20 // Constructs an ExtensionPrefStore for a regular or an incognito profile. | 19 // Constructs an ExtensionPrefStore for a regular or an incognito profile. |
21 ExtensionPrefStore(ExtensionPrefValueMap* extension_pref_value_map, | 20 ExtensionPrefStore(ExtensionPrefValueMap* extension_pref_value_map, |
22 bool incognito_pref_store); | 21 bool incognito_pref_store); |
23 | 22 |
24 // Overrides for ExtensionPrefValueMap::Observer: | 23 // Overrides for ExtensionPrefValueMap::Observer: |
25 virtual void OnInitializationCompleted() OVERRIDE; | 24 virtual void OnInitializationCompleted() OVERRIDE; |
26 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; | 25 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; |
27 virtual void OnExtensionPrefValueMapDestruction() OVERRIDE; | 26 virtual void OnExtensionPrefValueMapDestruction() OVERRIDE; |
28 | 27 |
29 protected: | 28 protected: |
30 virtual ~ExtensionPrefStore(); | 29 virtual ~ExtensionPrefStore(); |
31 | 30 |
32 private: | 31 private: |
33 ExtensionPrefValueMap* extension_pref_value_map_; // Weak pointer. | 32 ExtensionPrefValueMap* extension_pref_value_map_; // Weak pointer. |
34 bool incognito_pref_store_; | 33 bool incognito_pref_store_; |
35 | 34 |
36 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefStore); | 35 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefStore); |
37 }; | 36 }; |
38 | 37 |
39 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_ | 38 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREF_STORE_H_ |
OLD | NEW |