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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_member.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h"
11 #include "content/public/browser/notification_registrar.h"
17 namespace extensions {
23 // Font settings overlay page UI handler.
24 class FontSettingsHandler : public OptionsPageUIHandler {
26 FontSettingsHandler();
27 virtual ~FontSettingsHandler();
29 // OptionsPageUIHandler implementation.
30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE;
31 virtual void InitializeHandler() OVERRIDE;
32 virtual void InitializePage() OVERRIDE;
34 // WebUIMessageHandler implementation.
35 virtual void RegisterMessages() OVERRIDE;
38 // OptionsPageUIHandler implementation.
39 virtual void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) OVERRIDE;
43 void HandleFetchFontsData(const ListValue* args);
45 void FontsListHasLoaded(scoped_ptr<base::ListValue> list);
47 void SetUpStandardFontSample();
48 void SetUpSerifFontSample();
49 void SetUpSansSerifFontSample();
50 void SetUpFixedFontSample();
51 void SetUpMinimumFontSample();
53 // Returns the Advanced Font Settings Extension if it's installed and enabled,
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);
62 void OnWebKitDefaultFontSizeChanged();
64 StringPrefMember standard_font_;
65 StringPrefMember serif_font_;
66 StringPrefMember sans_serif_font_;
67 StringPrefMember fixed_font_;
68 StringPrefMember font_encoding_;
69 IntegerPrefMember default_font_size_;
70 IntegerPrefMember default_fixed_font_size_;
71 IntegerPrefMember minimum_font_size_;
73 content::NotificationRegistrar registrar_;
75 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler);
78 } // namespace options
80 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_