Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/extensions/api/font_settings/font_settings_api.h

Issue 11826048: Revert 176015 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Defines the classes to realize the Font Settings Extension API as specified 5 // Defines the classes to realize the Font Settings Extension API as specified
6 // in the extension API JSON. 6 // in the extension API JSON.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__
9 #define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/public/pref_change_registrar.h" 14 #include "base/prefs/public/pref_change_registrar.h"
15 #include "chrome/browser/extensions/event_router.h" 15 #include "chrome/browser/extensions/event_router.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile_keyed_service.h" 18 #include "chrome/browser/profiles/profile_keyed_service.h"
19 19
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 class FontSettingsAPI : public ProfileKeyedService { 73 class FontSettingsAPI : public ProfileKeyedService {
74 public: 74 public:
75 explicit FontSettingsAPI(Profile* profile); 75 explicit FontSettingsAPI(Profile* profile);
76 virtual ~FontSettingsAPI(); 76 virtual ~FontSettingsAPI();
77 77
78 private: 78 private:
79 scoped_ptr<FontSettingsEventRouter> font_settings_event_router_; 79 scoped_ptr<FontSettingsEventRouter> font_settings_event_router_;
80 }; 80 };
81 81
82 // fontSettings.clearFont API function. 82 // fontSettings.clearFont API function.
83 class FontSettingsClearFontFunction : public SyncExtensionFunction { 83 class ClearFontFunction : public SyncExtensionFunction {
84 public: 84 public:
85 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearFont") 85 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearFont")
86 86
87 protected: 87 protected:
88 // RefCounted types have non-public destructors, as with all extension 88 // RefCounted types have non-public destructors, as with all extension
89 // functions in this file. 89 // functions in this file.
90 virtual ~FontSettingsClearFontFunction() {} 90 virtual ~ClearFontFunction() {}
91 91
92 // ExtensionFunction: 92 // ExtensionFunction:
93 virtual bool RunImpl() OVERRIDE; 93 virtual bool RunImpl() OVERRIDE;
94 }; 94 };
95 95
96 // fontSettings.getFont API function. 96 // fontSettings.getFont API function.
97 class FontSettingsGetFontFunction : public SyncExtensionFunction { 97 class GetFontFunction : public SyncExtensionFunction {
98 public: 98 public:
99 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFont") 99 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFont")
100 100
101 protected: 101 protected:
102 virtual ~FontSettingsGetFontFunction() {} 102 virtual ~GetFontFunction() {}
103 103
104 // ExtensionFunction: 104 // ExtensionFunction:
105 virtual bool RunImpl() OVERRIDE; 105 virtual bool RunImpl() OVERRIDE;
106 }; 106 };
107 107
108 // fontSettings.setFont API function. 108 // fontSettings.setFont API function.
109 class FontSettingsSetFontFunction : public SyncExtensionFunction { 109 class SetFontFunction : public SyncExtensionFunction {
110 public: 110 public:
111 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setFont") 111 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setFont")
112 112
113 protected: 113 protected:
114 virtual ~FontSettingsSetFontFunction() {} 114 virtual ~SetFontFunction() {}
115 115
116 // ExtensionFunction: 116 // ExtensionFunction:
117 virtual bool RunImpl() OVERRIDE; 117 virtual bool RunImpl() OVERRIDE;
118 }; 118 };
119 119
120 // fontSettings.getFontList API function. 120 // fontSettings.getFontList API function.
121 class FontSettingsGetFontListFunction : public AsyncExtensionFunction { 121 class GetFontListFunction : public AsyncExtensionFunction {
122 public: 122 public:
123 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFontList") 123 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFontList")
124 124
125 protected: 125 protected:
126 virtual ~FontSettingsGetFontListFunction() {} 126 virtual ~GetFontListFunction() {}
127 127
128 // ExtensionFunction: 128 // ExtensionFunction:
129 virtual bool RunImpl() OVERRIDE; 129 virtual bool RunImpl() OVERRIDE;
130 130
131 private: 131 private:
132 void FontListHasLoaded(scoped_ptr<base::ListValue> list); 132 void FontListHasLoaded(scoped_ptr<base::ListValue> list);
133 bool CopyFontsToResult(base::ListValue* fonts); 133 bool CopyFontsToResult(base::ListValue* fonts);
134 }; 134 };
135 135
136 // Base class for extension API functions that clear a browser font pref. 136 // Base class for extension API functions that clear a browser font pref.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual const char* GetPrefName() = 0; 176 virtual const char* GetPrefName() = 0;
177 177
178 // Implementations should return the key for the value in the extension API, 178 // Implementations should return the key for the value in the extension API,
179 // like "pixelSize". 179 // like "pixelSize".
180 virtual const char* GetKey() = 0; 180 virtual const char* GetKey() = 0;
181 }; 181 };
182 182
183 // The following are get/set/clear API functions that act on a browser font 183 // The following are get/set/clear API functions that act on a browser font
184 // pref. 184 // pref.
185 185
186 class FontSettingsClearDefaultFontSizeFunction 186 class ClearDefaultFontSizeFunction : public ClearFontPrefExtensionFunction {
187 : public ClearFontPrefExtensionFunction {
188 public: 187 public:
189 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFontSize") 188 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFontSize")
190 189
191 protected: 190 protected:
192 virtual ~FontSettingsClearDefaultFontSizeFunction() {} 191 virtual ~ClearDefaultFontSizeFunction() {}
193 192
194 // ClearFontPrefExtensionFunction: 193 // ClearFontPrefExtensionFunction:
195 virtual const char* GetPrefName() OVERRIDE; 194 virtual const char* GetPrefName() OVERRIDE;
196 }; 195 };
197 196
198 class FontSettingsGetDefaultFontSizeFunction 197 class GetDefaultFontSizeFunction : public GetFontPrefExtensionFunction {
199 : public GetFontPrefExtensionFunction {
200 public: 198 public:
201 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFontSize") 199 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFontSize")
202 200
203 protected: 201 protected:
204 virtual ~FontSettingsGetDefaultFontSizeFunction() {} 202 virtual ~GetDefaultFontSizeFunction() {}
205 203
206 // GetFontPrefExtensionFunction: 204 // GetFontPrefExtensionFunction:
207 virtual const char* GetPrefName() OVERRIDE; 205 virtual const char* GetPrefName() OVERRIDE;
208 virtual const char* GetKey() OVERRIDE; 206 virtual const char* GetKey() OVERRIDE;
209 }; 207 };
210 208
211 class FontSettingsSetDefaultFontSizeFunction 209 class SetDefaultFontSizeFunction : public SetFontPrefExtensionFunction {
212 : public SetFontPrefExtensionFunction {
213 public: 210 public:
214 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFontSize") 211 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFontSize")
215 212
216 protected: 213 protected:
217 virtual ~FontSettingsSetDefaultFontSizeFunction() {} 214 virtual ~SetDefaultFontSizeFunction() {}
218 215
219 // SetFontPrefExtensionFunction: 216 // SetFontPrefExtensionFunction:
220 virtual const char* GetPrefName() OVERRIDE; 217 virtual const char* GetPrefName() OVERRIDE;
221 virtual const char* GetKey() OVERRIDE; 218 virtual const char* GetKey() OVERRIDE;
222 }; 219 };
223 220
224 class FontSettingsClearDefaultFixedFontSizeFunction 221 class ClearDefaultFixedFontSizeFunction
225 : public ClearFontPrefExtensionFunction { 222 : public ClearFontPrefExtensionFunction {
226 public: 223 public:
227 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFixedFontSize") 224 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFixedFontSize")
228 225
229 protected: 226 protected:
230 virtual ~FontSettingsClearDefaultFixedFontSizeFunction() {} 227 virtual ~ClearDefaultFixedFontSizeFunction() {}
231 228
232 // ClearFontPrefExtensionFunction: 229 // ClearFontPrefExtensionFunction:
233 virtual const char* GetPrefName() OVERRIDE; 230 virtual const char* GetPrefName() OVERRIDE;
234 }; 231 };
235 232
236 class FontSettingsGetDefaultFixedFontSizeFunction 233 class GetDefaultFixedFontSizeFunction : public GetFontPrefExtensionFunction {
237 : public GetFontPrefExtensionFunction {
238 public: 234 public:
239 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFixedFontSize") 235 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFixedFontSize")
240 236
241 protected: 237 protected:
242 virtual ~FontSettingsGetDefaultFixedFontSizeFunction() {} 238 virtual ~GetDefaultFixedFontSizeFunction() {}
243 239
244 // GetFontPrefExtensionFunction: 240 // GetFontPrefExtensionFunction:
245 virtual const char* GetPrefName() OVERRIDE; 241 virtual const char* GetPrefName() OVERRIDE;
246 virtual const char* GetKey() OVERRIDE; 242 virtual const char* GetKey() OVERRIDE;
247 }; 243 };
248 244
249 class FontSettingsSetDefaultFixedFontSizeFunction 245 class SetDefaultFixedFontSizeFunction : public SetFontPrefExtensionFunction {
250 : public SetFontPrefExtensionFunction {
251 public: 246 public:
252 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFixedFontSize") 247 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFixedFontSize")
253 248
254 protected: 249 protected:
255 virtual ~FontSettingsSetDefaultFixedFontSizeFunction() {} 250 virtual ~SetDefaultFixedFontSizeFunction() {}
256 251
257 // SetFontPrefExtensionFunction: 252 // SetFontPrefExtensionFunction:
258 virtual const char* GetPrefName() OVERRIDE; 253 virtual const char* GetPrefName() OVERRIDE;
259 virtual const char* GetKey() OVERRIDE; 254 virtual const char* GetKey() OVERRIDE;
260 }; 255 };
261 256
262 class FontSettingsClearMinimumFontSizeFunction 257 class ClearMinimumFontSizeFunction : public ClearFontPrefExtensionFunction {
263 : public ClearFontPrefExtensionFunction {
264 public: 258 public:
265 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearMinimumFontSize") 259 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearMinimumFontSize")
266 260
267 protected: 261 protected:
268 virtual ~FontSettingsClearMinimumFontSizeFunction() {} 262 virtual ~ClearMinimumFontSizeFunction() {}
269 263
270 // ClearFontPrefExtensionFunction: 264 // ClearFontPrefExtensionFunction:
271 virtual const char* GetPrefName() OVERRIDE; 265 virtual const char* GetPrefName() OVERRIDE;
272 }; 266 };
273 267
274 class FontSettingsGetMinimumFontSizeFunction 268 class GetMinimumFontSizeFunction : public GetFontPrefExtensionFunction {
275 : public GetFontPrefExtensionFunction {
276 public: 269 public:
277 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getMinimumFontSize") 270 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getMinimumFontSize")
278 271
279 protected: 272 protected:
280 virtual ~FontSettingsGetMinimumFontSizeFunction() {} 273 virtual ~GetMinimumFontSizeFunction() {}
281 274
282 // GetFontPrefExtensionFunction: 275 // GetFontPrefExtensionFunction:
283 virtual const char* GetPrefName() OVERRIDE; 276 virtual const char* GetPrefName() OVERRIDE;
284 virtual const char* GetKey() OVERRIDE; 277 virtual const char* GetKey() OVERRIDE;
285 }; 278 };
286 279
287 class FontSettingsSetMinimumFontSizeFunction 280 class SetMinimumFontSizeFunction : public SetFontPrefExtensionFunction {
288 : public SetFontPrefExtensionFunction {
289 public: 281 public:
290 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setMinimumFontSize") 282 DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setMinimumFontSize")
291 283
292 protected: 284 protected:
293 virtual ~FontSettingsSetMinimumFontSizeFunction() {} 285 virtual ~SetMinimumFontSizeFunction() {}
294 286
295 // SetFontPrefExtensionFunction: 287 // SetFontPrefExtensionFunction:
296 virtual const char* GetPrefName() OVERRIDE; 288 virtual const char* GetPrefName() OVERRIDE;
297 virtual const char* GetKey() OVERRIDE; 289 virtual const char* GetKey() OVERRIDE;
298 }; 290 };
299 291
300 } // namespace extensions 292 } // namespace extensions
301 293
302 #endif // CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ 294 #endif // CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698