| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 // BrowserContextKeyedAPI implementation. | 102 // BrowserContextKeyedAPI implementation. |
| 103 static BrowserContextKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); | 103 static BrowserContextKeyedAPIFactory<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(content::BrowserContext* context); | 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 | |
| 112 // dictionary and sets them in the |value_map|. | |
| 113 static void LoadExtensionControlledPrefs(ExtensionPrefs* prefs, | |
| 114 ExtensionPrefValueMap* value_map, | |
| 115 const std::string& extension_id, | |
| 116 ExtensionPrefsScope scope); | |
| 117 | |
| 118 // Store extension controlled preference values in the |value_map|, | |
| 119 // which then informs the subscribers (ExtensionPrefStores) about the winning | |
| 120 // values. | |
| 121 static void InitExtensionControlledPrefs(ExtensionPrefs* prefs, | |
| 122 ExtensionPrefValueMap* value_map); | |
| 123 | |
| 124 private: | 111 private: |
| 125 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; | 112 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; |
| 126 | 113 |
| 127 // ContentSettingsStore::Observer implementation. | 114 // ContentSettingsStore::Observer implementation. |
| 128 virtual void OnContentSettingChanged(const std::string& extension_id, | 115 virtual void OnContentSettingChanged(const std::string& extension_id, |
| 129 bool incognito) OVERRIDE; | 116 bool incognito) OVERRIDE; |
| 130 | 117 |
| 131 // Clears incognito session-only content settings for all extensions. | 118 // Clears incognito session-only content settings for all extensions. |
| 132 void ClearIncognitoSessionOnlyContentSettings(); | 119 void ClearIncognitoSessionOnlyContentSettings(); |
| 133 | 120 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 protected: | 208 protected: |
| 222 virtual ~ClearPreferenceFunction(); | 209 virtual ~ClearPreferenceFunction(); |
| 223 | 210 |
| 224 // ExtensionFunction: | 211 // ExtensionFunction: |
| 225 virtual bool RunImpl() OVERRIDE; | 212 virtual bool RunImpl() OVERRIDE; |
| 226 }; | 213 }; |
| 227 | 214 |
| 228 } // namespace extensions | 215 } // namespace extensions |
| 229 | 216 |
| 230 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 217 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| OLD | NEW |