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