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_EXTENSION_FONT_SETTINGS_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FONT_SETTINGS_API_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FONT_SETTINGS_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FONT_SETTINGS_API_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 class GetFontListFunction : public AsyncExtensionFunction { | 23 class GetFontListFunction : public AsyncExtensionFunction { |
24 public: | 24 public: |
25 virtual bool RunImpl() OVERRIDE; | 25 virtual bool RunImpl() OVERRIDE; |
26 DECLARE_EXTENSION_FUNCTION_NAME("experimental.fontSettings.getFontList") | 26 DECLARE_EXTENSION_FUNCTION_NAME("experimental.fontSettings.getFontList") |
27 | 27 |
28 private: | 28 private: |
29 void FontListHasLoaded(scoped_ptr<base::ListValue> list); | 29 void FontListHasLoaded(scoped_ptr<base::ListValue> list); |
30 bool CopyFontsToResult(base::ListValue* fonts); | 30 bool CopyFontsToResult(base::ListValue* fonts); |
31 }; | 31 }; |
32 | 32 |
33 class GetDefaultFontSizeFunction : public SyncExtensionFunction { | 33 // Base class for functions that get a font size. |
| 34 class GetFontSizeExtensionFunction : public SyncExtensionFunction { |
| 35 protected: |
| 36 virtual bool RunImpl() OVERRIDE; |
| 37 |
| 38 // Implementations should return the name of the font size preference to get. |
| 39 virtual const char* GetPrefName() = 0; |
| 40 }; |
| 41 |
| 42 // Base class for functions that set a font size. |
| 43 class SetFontSizeExtensionFunction : public SyncExtensionFunction { |
| 44 protected: |
| 45 virtual bool RunImpl() OVERRIDE; |
| 46 |
| 47 // Implementations should return the name of the font size preference to set. |
| 48 virtual const char* GetPrefName() = 0; |
| 49 }; |
| 50 |
| 51 class GetDefaultFontSizeFunction : public GetFontSizeExtensionFunction { |
34 public: | 52 public: |
35 virtual bool RunImpl() OVERRIDE; | |
36 DECLARE_EXTENSION_FUNCTION_NAME( | 53 DECLARE_EXTENSION_FUNCTION_NAME( |
37 "experimental.fontSettings.getDefaultFontSize") | 54 "experimental.fontSettings.getDefaultFontSize") |
| 55 |
| 56 protected: |
| 57 virtual const char* GetPrefName() OVERRIDE; |
38 }; | 58 }; |
39 | 59 |
40 class SetDefaultFontSizeFunction : public SyncExtensionFunction { | 60 class SetDefaultFontSizeFunction : public SetFontSizeExtensionFunction { |
41 public: | 61 public: |
42 virtual bool RunImpl() OVERRIDE; | |
43 DECLARE_EXTENSION_FUNCTION_NAME( | 62 DECLARE_EXTENSION_FUNCTION_NAME( |
44 "experimental.fontSettings.setDefaultFontSize") | 63 "experimental.fontSettings.setDefaultFontSize") |
| 64 |
| 65 protected: |
| 66 virtual const char* GetPrefName() OVERRIDE; |
| 67 }; |
| 68 |
| 69 class GetDefaultFixedFontSizeFunction : public GetFontSizeExtensionFunction { |
| 70 public: |
| 71 DECLARE_EXTENSION_FUNCTION_NAME( |
| 72 "experimental.fontSettings.getDefaultFixedFontSize") |
| 73 |
| 74 protected: |
| 75 virtual const char* GetPrefName() OVERRIDE; |
| 76 }; |
| 77 |
| 78 class SetDefaultFixedFontSizeFunction : public SetFontSizeExtensionFunction { |
| 79 public: |
| 80 DECLARE_EXTENSION_FUNCTION_NAME( |
| 81 "experimental.fontSettings.setDefaultFixedFontSize") |
| 82 |
| 83 protected: |
| 84 virtual const char* GetPrefName() OVERRIDE; |
| 85 }; |
| 86 |
| 87 class GetMinimumFontSizeFunction : public GetFontSizeExtensionFunction { |
| 88 public: |
| 89 DECLARE_EXTENSION_FUNCTION_NAME( |
| 90 "experimental.fontSettings.getMinimumFontSize") |
| 91 |
| 92 protected: |
| 93 virtual const char* GetPrefName() OVERRIDE; |
| 94 }; |
| 95 |
| 96 class SetMinimumFontSizeFunction : public SetFontSizeExtensionFunction { |
| 97 public: |
| 98 DECLARE_EXTENSION_FUNCTION_NAME( |
| 99 "experimental.fontSettings.setMinimumFontSize") |
| 100 |
| 101 protected: |
| 102 virtual const char* GetPrefName() OVERRIDE; |
45 }; | 103 }; |
46 | 104 |
47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FONT_SETTINGS_API_H__ | 105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FONT_SETTINGS_API_H__ |
OLD | NEW |