Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/ui/webui/settings_utils.cc

Issue 2927273002: Move code for old, deprecated Options UI to only ChromeOS (Closed)
Patch Set: font utils Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/ui/webui/settings_utils.h" 5 #include "chrome/browser/ui/webui/settings_utils.h"
6 6
7 #include "chrome/browser/extensions/extension_tab_util.h" 7 #include "chrome/browser/extensions/extension_tab_util.h"
8 #include "chrome/grit/theme_resources.h" 8 #include "chrome/grit/theme_resources.h"
9 #include "components/url_formatter/url_fixer.h" 9 #include "components/url_formatter/url_fixer.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/font_list.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace settings_utils { 14 namespace settings_utils {
14 15
15 bool FixupAndValidateStartupPage(const std::string& url_string, 16 bool FixupAndValidateStartupPage(const std::string& url_string,
16 GURL* fixed_url) { 17 GURL* fixed_url) {
17 GURL url = url_formatter::FixupURL(url_string, std::string()); 18 GURL url = url_formatter::FixupURL(url_string, std::string());
18 bool valid = url.is_valid() && !extensions::ExtensionTabUtil::IsKillURL(url); 19 bool valid = url.is_valid() && !extensions::ExtensionTabUtil::IsKillURL(url);
19 if (valid && fixed_url) 20 if (valid && fixed_url)
20 fixed_url->Swap(&url); 21 fixed_url->Swap(&url);
21 return valid; 22 return valid;
22 } 23 }
23 24
24 base::RefCountedMemory* GetFaviconResourceBytes(ui::ScaleFactor scale_factor) { 25 base::RefCountedMemory* GetFaviconResourceBytes(ui::ScaleFactor scale_factor) {
25 return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 26 return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
26 IDR_SETTINGS_FAVICON, scale_factor); 27 IDR_SETTINGS_FAVICON, scale_factor);
27 } 28 }
28 29
30 #if !defined(OS_MACOSX)
31 void ValidateSavedFonts(PrefService* prefs) {
Lei Zhang 2017/06/09 04:22:53 Why not just make this function Mac only then? Fix
Dan Beam 2017/06/09 06:32:55 Done.
32 // Nothing to do on Windows, Linux, or ChromeOS.
33 }
34 #endif
35
36 std::string ResolveFontList(const std::string& font_name_or_list) {
37 if (!font_name_or_list.empty() && font_name_or_list[0] == ',')
38 return gfx::FontList::FirstAvailableOrFirst(font_name_or_list);
39 return font_name_or_list;
40 }
41
42 #if !defined(OS_WIN)
43 std::string MaybeGetLocalizedFontName(const std::string& font_name_or_list) {
44 return ResolveFontList(font_name_or_list);
45 }
46 #endif
47
29 } // namespace settings_utils 48 } // namespace settings_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698