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

Side by Side Diff: ui/gfx/font_fallback_win.cc

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/gfx/font_fallback_win.h" 5 #include "ui/gfx/font_fallback_win.h"
6 6
7 #include <usp10.h> 7 #include <usp10.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 11 matching lines...) Expand all
22 namespace { 22 namespace {
23 23
24 // Queries the registry to get a mapping from font filenames to font names. 24 // Queries the registry to get a mapping from font filenames to font names.
25 void QueryFontsFromRegistry(std::map<std::string, std::string>* map) { 25 void QueryFontsFromRegistry(std::map<std::string, std::string>* map) {
26 const wchar_t* kFonts = 26 const wchar_t* kFonts =
27 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"; 27 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
28 28
29 base::win::RegistryValueIterator it(HKEY_LOCAL_MACHINE, kFonts); 29 base::win::RegistryValueIterator it(HKEY_LOCAL_MACHINE, kFonts);
30 for (; it.Valid(); ++it) { 30 for (; it.Valid(); ++it) {
31 const std::string filename = 31 const std::string filename =
32 base::StringToLowerASCII(base::WideToUTF8(it.Value())); 32 base::ToLowerASCII(base::WideToUTF8(it.Value()));
33 (*map)[filename] = base::WideToUTF8(it.Name()); 33 (*map)[filename] = base::WideToUTF8(it.Name());
34 } 34 }
35 } 35 }
36 36
37 // Fills |font_names| with a list of font families found in the font file at 37 // Fills |font_names| with a list of font families found in the font file at
38 // |filename|. Takes in a |font_map| from font filename to font families, which 38 // |filename|. Takes in a |font_map| from font filename to font families, which
39 // is filled-in by querying the registry, if empty. 39 // is filled-in by querying the registry, if empty.
40 void GetFontNamesFromFilename(const std::string& filename, 40 void GetFontNamesFromFilename(const std::string& filename,
41 std::map<std::string, std::string>* font_map, 41 std::map<std::string, std::string>* font_map,
42 std::vector<std::string>* font_names) { 42 std::vector<std::string>* font_names) {
43 if (font_map->empty()) 43 if (font_map->empty())
44 QueryFontsFromRegistry(font_map); 44 QueryFontsFromRegistry(font_map);
45 45
46 std::map<std::string, std::string>::const_iterator it = 46 std::map<std::string, std::string>::const_iterator it =
47 font_map->find(base::StringToLowerASCII(filename)); 47 font_map->find(base::ToLowerASCII(filename));
48 if (it == font_map->end()) 48 if (it == font_map->end())
49 return; 49 return;
50 50
51 internal::ParseFontFamilyString(it->second, font_names); 51 internal::ParseFontFamilyString(it->second, font_names);
52 } 52 }
53 53
54 // Returns true if |text| contains only ASCII digits. 54 // Returns true if |text| contains only ASCII digits.
55 bool ContainsOnlyDigits(const std::string& text) { 55 bool ContainsOnlyDigits(const std::string& text) {
56 return text.find_first_not_of("0123456789") == base::string16::npos; 56 return text.find_first_not_of("0123456789") == base::string16::npos;
57 } 57 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 font.GetFontSize()); 322 font.GetFontSize());
323 found_fallback = true; 323 found_fallback = true;
324 } 324 }
325 } 325 }
326 DeleteEnhMetaFile(meta_file); 326 DeleteEnhMetaFile(meta_file);
327 327
328 return found_fallback; 328 return found_fallback;
329 } 329 }
330 330
331 } // namespace gfx 331 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc ('k') | ui/gfx/font_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698