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_observer.h"
12 #include "content/public/browser/notification_registrar.h"
18 namespace extensions {
24 // Font settings overlay page UI handler.
25 class FontSettingsHandler : public OptionsPageUIHandler,
26 public content::NotificationObserver {
28 FontSettingsHandler();
29 virtual ~FontSettingsHandler();
31 // OptionsPageUIHandler implementation.
32 virtual void GetLocalizedValues(
33 base::DictionaryValue* localized_strings) OVERRIDE;
34 virtual void InitializeHandler() OVERRIDE;
35 virtual void InitializePage() OVERRIDE;
37 // WebUIMessageHandler implementation.
38 virtual void RegisterMessages() OVERRIDE;
41 // content::NotificationObserver implementation.
42 virtual void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) OVERRIDE;
46 void HandleFetchFontsData(const base::ListValue* args);
48 void FontsListHasLoaded(scoped_ptr<base::ListValue> list);
50 void SetUpStandardFontSample();
51 void SetUpSerifFontSample();
52 void SetUpSansSerifFontSample();
53 void SetUpFixedFontSample();
54 void SetUpMinimumFontSample();
56 // Returns the Advanced Font Settings Extension if it's installed and enabled,
58 const extensions::Extension* GetAdvancedFontSettingsExtension();
59 // Notifies the web UI about whether the Advanced Font Settings Extension is
60 // installed and enabled.
61 void NotifyAdvancedFontSettingsAvailability();
62 // Opens the options page of the Advanced Font Settings Extension.
63 void HandleOpenAdvancedFontSettingsOptions(const base::ListValue* args);
65 void OnWebKitDefaultFontSizeChanged();
67 StringPrefMember standard_font_;
68 StringPrefMember serif_font_;
69 StringPrefMember sans_serif_font_;
70 StringPrefMember fixed_font_;
71 StringPrefMember font_encoding_;
72 IntegerPrefMember default_font_size_;
73 IntegerPrefMember default_fixed_font_size_;
74 IntegerPrefMember minimum_font_size_;
76 content::NotificationRegistrar registrar_;
78 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler);
81 } // namespace options
83 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_