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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 class PreferenceAPI : public PreferenceAPIBase, | 93 class PreferenceAPI : public PreferenceAPIBase, |
94 public BrowserContextKeyedAPI, | 94 public BrowserContextKeyedAPI, |
95 public EventRouter::Observer, | 95 public EventRouter::Observer, |
96 public ContentSettingsStore::Observer { | 96 public ContentSettingsStore::Observer { |
97 public: | 97 public: |
98 explicit PreferenceAPI(content::BrowserContext* context); | 98 explicit PreferenceAPI(content::BrowserContext* context); |
99 virtual ~PreferenceAPI(); | 99 virtual ~PreferenceAPI(); |
100 | 100 |
101 // KeyedService implementation. | 101 // KeyedService implementation. |
102 virtual void Shutdown() OVERRIDE; | 102 virtual void Shutdown() override; |
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 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 111 virtual void OnListenerAdded(const EventListenerInfo& details) override; |
112 | 112 |
113 private: | 113 private: |
114 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; | 114 friend class BrowserContextKeyedAPIFactory<PreferenceAPI>; |
115 | 115 |
116 // ContentSettingsStore::Observer implementation. | 116 // ContentSettingsStore::Observer implementation. |
117 virtual void OnContentSettingChanged(const std::string& extension_id, | 117 virtual void OnContentSettingChanged(const std::string& extension_id, |
118 bool incognito) OVERRIDE; | 118 bool incognito) override; |
119 | 119 |
120 // Clears incognito session-only content settings for all extensions. | 120 // Clears incognito session-only content settings for all extensions. |
121 void ClearIncognitoSessionOnlyContentSettings(); | 121 void ClearIncognitoSessionOnlyContentSettings(); |
122 | 122 |
123 // PreferenceAPIBase implementation. | 123 // PreferenceAPIBase implementation. |
124 virtual ExtensionPrefs* extension_prefs() OVERRIDE; | 124 virtual ExtensionPrefs* extension_prefs() override; |
125 virtual ExtensionPrefValueMap* extension_pref_value_map() OVERRIDE; | 125 virtual ExtensionPrefValueMap* extension_pref_value_map() override; |
126 virtual scoped_refptr<ContentSettingsStore> content_settings_store() OVERRIDE; | 126 virtual scoped_refptr<ContentSettingsStore> content_settings_store() override; |
127 | 127 |
128 Profile* profile_; | 128 Profile* profile_; |
129 | 129 |
130 // BrowserContextKeyedAPI implementation. | 130 // BrowserContextKeyedAPI implementation. |
131 static const char* service_name() { | 131 static const char* service_name() { |
132 return "PreferenceAPI"; | 132 return "PreferenceAPI"; |
133 } | 133 } |
134 static const bool kServiceIsNULLWhileTesting = true; | 134 static const bool kServiceIsNULLWhileTesting = true; |
135 static const bool kServiceRedirectedInIncognito = true; | 135 static const bool kServiceRedirectedInIncognito = true; |
136 | 136 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 }; | 182 }; |
183 | 183 |
184 class GetPreferenceFunction : public PreferenceFunction { | 184 class GetPreferenceFunction : public PreferenceFunction { |
185 public: | 185 public: |
186 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.get", TYPES_CHROMESETTING_GET) | 186 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.get", TYPES_CHROMESETTING_GET) |
187 | 187 |
188 protected: | 188 protected: |
189 virtual ~GetPreferenceFunction(); | 189 virtual ~GetPreferenceFunction(); |
190 | 190 |
191 // ExtensionFunction: | 191 // ExtensionFunction: |
192 virtual bool RunSync() OVERRIDE; | 192 virtual bool RunSync() override; |
193 }; | 193 }; |
194 | 194 |
195 class SetPreferenceFunction : public PreferenceFunction { | 195 class SetPreferenceFunction : public PreferenceFunction { |
196 public: | 196 public: |
197 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.set", TYPES_CHROMESETTING_SET) | 197 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.set", TYPES_CHROMESETTING_SET) |
198 | 198 |
199 protected: | 199 protected: |
200 virtual ~SetPreferenceFunction(); | 200 virtual ~SetPreferenceFunction(); |
201 | 201 |
202 // ExtensionFunction: | 202 // ExtensionFunction: |
203 virtual bool RunSync() OVERRIDE; | 203 virtual bool RunSync() override; |
204 }; | 204 }; |
205 | 205 |
206 class ClearPreferenceFunction : public PreferenceFunction { | 206 class ClearPreferenceFunction : public PreferenceFunction { |
207 public: | 207 public: |
208 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.clear", | 208 DECLARE_EXTENSION_FUNCTION("types.ChromeSetting.clear", |
209 TYPES_CHROMESETTING_CLEAR) | 209 TYPES_CHROMESETTING_CLEAR) |
210 | 210 |
211 protected: | 211 protected: |
212 virtual ~ClearPreferenceFunction(); | 212 virtual ~ClearPreferenceFunction(); |
213 | 213 |
214 // ExtensionFunction: | 214 // ExtensionFunction: |
215 virtual bool RunSync() OVERRIDE; | 215 virtual bool RunSync() override; |
216 }; | 216 }; |
217 | 217 |
218 } // namespace extensions | 218 } // namespace extensions |
219 | 219 |
220 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 220 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
OLD | NEW |