| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SETTINGS_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/base/resource/scale_factor.h" | 11 #include "ui/base/resource/scale_factor.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 class PrefService; |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class RefCountedMemory; | 17 class RefCountedMemory; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class WebContents; | 21 class WebContents; |
| 21 } | 22 } |
| 22 | 23 |
| 24 // Chrome settings utility methods. |
| 23 namespace settings_utils { | 25 namespace settings_utils { |
| 24 | 26 |
| 25 // Invoke UI for network proxy settings. | 27 // Invoke UI for network proxy settings. |
| 26 void ShowNetworkProxySettings(content::WebContents* web_contents); | 28 void ShowNetworkProxySettings(content::WebContents* web_contents); |
| 27 | 29 |
| 28 // Invoke UI for SSL certificates. | 30 // Invoke UI for SSL certificates. |
| 29 void ShowManageSSLCertificates(content::WebContents* web_contents); | 31 void ShowManageSSLCertificates(content::WebContents* web_contents); |
| 30 | 32 |
| 31 // Returns whether |url_string| is a valid startup page. |fixed_url| is set to | 33 // Returns whether |url_string| is a valid startup page. |fixed_url| is set to |
| 32 // the fixed up, valid URL if not null. | 34 // the fixed up, valid URL if not null. |
| 33 bool FixupAndValidateStartupPage(const std::string& url_string, | 35 bool FixupAndValidateStartupPage(const std::string& url_string, |
| 34 GURL* fixed_url); | 36 GURL* fixed_url); |
| 35 | 37 |
| 36 base::RefCountedMemory* GetFaviconResourceBytes(ui::ScaleFactor scale_factor); | 38 base::RefCountedMemory* GetFaviconResourceBytes(ui::ScaleFactor scale_factor); |
| 37 | 39 |
| 40 #if defined(OS_MACOSX) |
| 41 void ValidateSavedFonts(PrefService* prefs); |
| 42 #endif |
| 43 |
| 44 // When |font_name_or_list| starts with ",", it is a list of font names |
| 45 // separated by "," and this function returns the first available font name. |
| 46 // Otherwise returns |font_name_or_list| as is. |
| 47 // Unlike gfx::FontList, this function picks one font, and character-level |
| 48 // fallback is handled in CSS. |
| 49 std::string ResolveFontList(const std::string& font_name_or_list); |
| 50 |
| 51 // Returns the localized name of a font so that settings can find it within |
| 52 // the list of system fonts. On Windows, the list of system fonts has names |
| 53 // only for the system locale, but the pref value may be in the English name. |
| 54 // For example, "MS Gothic" becomes "MS ゴシック" on localized Windows. |
| 55 std::string MaybeGetLocalizedFontName(const std::string& font_name_or_list); |
| 56 |
| 38 } // namespace settings_utils | 57 } // namespace settings_utils |
| 39 | 58 |
| 40 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ | 59 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ |
| OLD | NEW |