| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // BrowserContextKeyedAPI implementation. | 104 // BrowserContextKeyedAPI implementation. |
| 105 static BrowserContextKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); | 105 static BrowserContextKeyedAPIFactory<PreferenceAPI>* GetFactoryInstance(); |
| 106 | 106 |
| 107 // Convenience method to get the PreferenceAPI for a profile. | 107 // Convenience method to get the PreferenceAPI for a profile. |
| 108 static PreferenceAPI* Get(content::BrowserContext* context); | 108 static PreferenceAPI* Get(content::BrowserContext* context); |
| 109 | 109 |
| 110 // EventRouter::Observer implementation. | 110 // EventRouter::Observer implementation. |
| 111 void OnListenerAdded(const EventListenerInfo& details) override; | 111 void OnListenerAdded(const EventListenerInfo& details) override; |
| 112 | 112 |
| 113 void UpdateAnimationPolicy(); |
| 114 |
| 113 private: | 115 private: |
| 114 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; | 116 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; |
| 115 | 117 |
| 116 // ContentSettingsStore::Observer implementation. | 118 // ContentSettingsStore::Observer implementation. |
| 117 void OnContentSettingChanged(const std::string& extension_id, | 119 void OnContentSettingChanged(const std::string& extension_id, |
| 118 bool incognito) override; | 120 bool incognito) override; |
| 119 | 121 |
| 120 // Clears incognito session-only content settings for all extensions. | 122 // Clears incognito session-only content settings for all extensions. |
| 121 void ClearIncognitoSessionOnlyContentSettings(); | 123 void ClearIncognitoSessionOnlyContentSettings(); |
| 122 | 124 |
| 123 // PreferenceAPIBase implementation. | 125 // PreferenceAPIBase implementation. |
| 124 ExtensionPrefs* extension_prefs() override; | 126 ExtensionPrefs* extension_prefs() override; |
| 125 ExtensionPrefValueMap* extension_pref_value_map() override; | 127 ExtensionPrefValueMap* extension_pref_value_map() override; |
| 126 scoped_refptr<ContentSettingsStore> content_settings_store() override; | 128 scoped_refptr<ContentSettingsStore> content_settings_store() override; |
| 127 | 129 |
| 128 Profile* profile_; | 130 Profile* profile_; |
| 131 PrefChangeRegistrar pref_change_registrar_; |
| 129 | 132 |
| 130 // BrowserContextKeyedAPI implementation. | 133 // BrowserContextKeyedAPI implementation. |
| 131 static const char* service_name() { | 134 static const char* service_name() { |
| 132 return "PreferenceAPI"; | 135 return "PreferenceAPI"; |
| 133 } | 136 } |
| 134 static const bool kServiceIsNULLWhileTesting = true; | 137 static const bool kServiceIsNULLWhileTesting = true; |
| 135 static const bool kServiceRedirectedInIncognito = true; | 138 static const bool kServiceRedirectedInIncognito = true; |
| 136 | 139 |
| 137 // Created lazily upon OnListenerAdded. | 140 // Created lazily upon OnListenerAdded. |
| 138 scoped_ptr<PreferenceEventRouter> preference_event_router_; | 141 scoped_ptr<PreferenceEventRouter> preference_event_router_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 protected: | 214 protected: |
| 212 ~ClearPreferenceFunction() override; | 215 ~ClearPreferenceFunction() override; |
| 213 | 216 |
| 214 // ExtensionFunction: | 217 // ExtensionFunction: |
| 215 bool RunSync() override; | 218 bool RunSync() override; |
| 216 }; | 219 }; |
| 217 | 220 |
| 218 } // namespace extensions | 221 } // namespace extensions |
| 219 | 222 |
| 220 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 223 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| OLD | NEW |