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_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
10 #include "chrome/browser/ui/webui/options/options_ui.h" | 10 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class ListValue; | 14 class ListValue; |
14 } | 15 } |
15 | 16 |
| 17 namespace extensions { |
| 18 class Extension; |
| 19 } |
| 20 |
16 namespace options { | 21 namespace options { |
17 | 22 |
18 // Font settings overlay page UI handler. | 23 // Font settings overlay page UI handler. |
19 class FontSettingsHandler : public OptionsPageUIHandler { | 24 class FontSettingsHandler : public OptionsPageUIHandler { |
20 public: | 25 public: |
21 FontSettingsHandler(); | 26 FontSettingsHandler(); |
22 virtual ~FontSettingsHandler(); | 27 virtual ~FontSettingsHandler(); |
23 | 28 |
24 // OptionsPageUIHandler implementation. | 29 // OptionsPageUIHandler implementation. |
25 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
| 31 virtual void InitializeHandler() OVERRIDE; |
26 virtual void InitializePage() OVERRIDE; | 32 virtual void InitializePage() OVERRIDE; |
27 | 33 |
28 // WebUIMessageHandler implementation. | 34 // WebUIMessageHandler implementation. |
29 virtual void RegisterMessages() OVERRIDE; | 35 virtual void RegisterMessages() OVERRIDE; |
30 | 36 |
31 private: | 37 private: |
| 38 // OptionsPageUIHandler implementation. |
| 39 virtual void Observe(int type, |
| 40 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) OVERRIDE; |
| 42 |
32 void HandleFetchFontsData(const ListValue* args); | 43 void HandleFetchFontsData(const ListValue* args); |
33 | 44 |
34 void FontsListHasLoaded(scoped_ptr<base::ListValue> list); | 45 void FontsListHasLoaded(scoped_ptr<base::ListValue> list); |
35 | 46 |
36 void SetUpStandardFontSample(); | 47 void SetUpStandardFontSample(); |
37 void SetUpSerifFontSample(); | 48 void SetUpSerifFontSample(); |
38 void SetUpSansSerifFontSample(); | 49 void SetUpSansSerifFontSample(); |
39 void SetUpFixedFontSample(); | 50 void SetUpFixedFontSample(); |
40 void SetUpMinimumFontSample(); | 51 void SetUpMinimumFontSample(); |
| 52 |
| 53 // Returns the Advanced Font Settings Extension if it's installed and enabled, |
| 54 // or NULL otherwise. |
| 55 const extensions::Extension* GetAdvancedFontSettingsExtension(); |
| 56 // Notifies the web UI about whether the Advanced Font Settings Extension is |
| 57 // installed and enabled. |
| 58 void NotifyAdvancedFontSettingsAvailability(); |
| 59 // Opens the options page of the Advanced Font Settings Extension. |
| 60 void HandleOpenAdvancedFontSettingsOptions(const base::ListValue* args); |
| 61 |
41 void OnWebKitDefaultFontSizeChanged(); | 62 void OnWebKitDefaultFontSizeChanged(); |
42 | 63 |
43 StringPrefMember standard_font_; | 64 StringPrefMember standard_font_; |
44 StringPrefMember serif_font_; | 65 StringPrefMember serif_font_; |
45 StringPrefMember sans_serif_font_; | 66 StringPrefMember sans_serif_font_; |
46 StringPrefMember fixed_font_; | 67 StringPrefMember fixed_font_; |
47 StringPrefMember font_encoding_; | 68 StringPrefMember font_encoding_; |
48 IntegerPrefMember default_font_size_; | 69 IntegerPrefMember default_font_size_; |
49 IntegerPrefMember default_fixed_font_size_; | 70 IntegerPrefMember default_fixed_font_size_; |
50 IntegerPrefMember minimum_font_size_; | 71 IntegerPrefMember minimum_font_size_; |
51 | 72 |
| 73 content::NotificationRegistrar registrar_; |
| 74 |
52 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler); | 75 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler); |
53 }; | 76 }; |
54 | 77 |
55 } // namespace options | 78 } // namespace options |
56 | 79 |
57 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ | 80 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_ |
OLD | NEW |