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 "base/scoped_observer.h"
11 #include "chrome/browser/ui/webui/options/options_ui.h"
12 #include "extensions/browser/extension_registry_observer.h"
18 namespace extensions
{
20 class ExtensionRegistry
;
25 // Font settings overlay page UI handler.
26 class FontSettingsHandler
: public OptionsPageUIHandler
,
27 public extensions::ExtensionRegistryObserver
{
29 FontSettingsHandler();
30 ~FontSettingsHandler() override
;
32 // OptionsPageUIHandler implementation.
33 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
34 void InitializeHandler() override
;
35 void InitializePage() override
;
37 // WebUIMessageHandler implementation.
38 void RegisterMessages() override
;
40 // ExtensionRegistryObserver implementation.
41 void OnExtensionLoaded(content::BrowserContext
* browser_context
,
42 const extensions::Extension
* extension
) override
;
43 void OnExtensionUnloaded(
44 content::BrowserContext
* browser_context
,
45 const extensions::Extension
* extension
,
46 extensions::UnloadedExtensionInfo::Reason reason
) override
;
49 void HandleFetchFontsData(const base::ListValue
* args
);
51 void FontsListHasLoaded(scoped_ptr
<base::ListValue
> list
);
53 void SetUpStandardFontSample();
54 void SetUpSerifFontSample();
55 void SetUpSansSerifFontSample();
56 void SetUpFixedFontSample();
57 void SetUpMinimumFontSample();
59 // Returns the Advanced Font Settings Extension if it's installed and enabled,
61 const extensions::Extension
* GetAdvancedFontSettingsExtension();
62 // Notifies the web UI about whether the Advanced Font Settings Extension is
63 // installed and enabled.
64 void NotifyAdvancedFontSettingsAvailability();
65 // Opens the options page of the Advanced Font Settings Extension.
66 void HandleOpenAdvancedFontSettingsOptions(const base::ListValue
* args
);
68 void OnWebKitDefaultFontSizeChanged();
70 StringPrefMember standard_font_
;
71 StringPrefMember serif_font_
;
72 StringPrefMember sans_serif_font_
;
73 StringPrefMember fixed_font_
;
74 StringPrefMember font_encoding_
;
75 IntegerPrefMember default_font_size_
;
76 IntegerPrefMember default_fixed_font_size_
;
77 IntegerPrefMember minimum_font_size_
;
79 ScopedObserver
<extensions::ExtensionRegistry
,
80 extensions::ExtensionRegistryObserver
>
81 extension_registry_observer_
;
83 DISALLOW_COPY_AND_ASSIGN(FontSettingsHandler
);
86 } // namespace options
88 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_FONT_SETTINGS_HANDLER_H_