| 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_API_PREFERENCE_PREFERENCE_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Virtual for testing. | 86 // Virtual for testing. |
| 87 virtual ExtensionPrefs* extension_prefs() = 0; | 87 virtual ExtensionPrefs* extension_prefs() = 0; |
| 88 virtual ExtensionPrefValueMap* extension_pref_value_map() = 0; | 88 virtual ExtensionPrefValueMap* extension_pref_value_map() = 0; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 class PreferenceAPI : public PreferenceAPIBase, | 91 class PreferenceAPI : public PreferenceAPIBase, |
| 92 public ProfileKeyedAPI, | 92 public ProfileKeyedAPI, |
| 93 public EventRouter::Observer, | 93 public EventRouter::Observer, |
| 94 public ContentSettingsStore::Observer { | 94 public ContentSettingsStore::Observer { |
| 95 public: | 95 public: |
| 96 explicit PreferenceAPI(Profile* profile); | 96 explicit PreferenceAPI(content::BrowserContext* context); |
| 97 virtual ~PreferenceAPI(); | 97 virtual ~PreferenceAPI(); |
| 98 | 98 |
| 99 // BrowserContextKeyedService implementation. | 99 // BrowserContextKeyedService implementation. |
| 100 virtual void Shutdown() OVERRIDE; | 100 virtual void Shutdown() OVERRIDE; |
| 101 | 101 |
| 102 // ProfileKeyedAPI implementation. | 102 // ProfileKeyedAPI implementation. |
| 103 static ProfileKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); | 103 static ProfileKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); |
| 104 | 104 |
| 105 // Convenience method to get the PreferenceAPI for a profile. | 105 // Convenience method to get the PreferenceAPI for a profile. |
| 106 static PreferenceAPI* Get(Profile* profile); | 106 static PreferenceAPI* Get(content::BrowserContext* context); |
| 107 | 107 |
| 108 // EventRouter::Observer implementation. | 108 // EventRouter::Observer implementation. |
| 109 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 109 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
| 110 | 110 |
| 111 // Loads the preferences controlled by the specified extension from their | 111 // Loads the preferences controlled by the specified extension from their |
| 112 // dictionary and sets them in the |value_map|. | 112 // dictionary and sets them in the |value_map|. |
| 113 static void LoadExtensionControlledPrefs(ExtensionPrefs* prefs, | 113 static void LoadExtensionControlledPrefs(ExtensionPrefs* prefs, |
| 114 ExtensionPrefValueMap* value_map, | 114 ExtensionPrefValueMap* value_map, |
| 115 const std::string& extension_id, | 115 const std::string& extension_id, |
| 116 ExtensionPrefsScope scope); | 116 ExtensionPrefsScope scope); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 protected: | 218 protected: |
| 219 virtual ~ClearPreferenceFunction(); | 219 virtual ~ClearPreferenceFunction(); |
| 220 | 220 |
| 221 // ExtensionFunction: | 221 // ExtensionFunction: |
| 222 virtual bool RunImpl() OVERRIDE; | 222 virtual bool RunImpl() OVERRIDE; |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 } // namespace extensions | 225 } // namespace extensions |
| 226 | 226 |
| 227 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 227 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| OLD | NEW |