OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/public/common/dwrite_font_platform_win.h" | 5 #include "content/public/common/dwrite_font_platform_win.h" |
6 | 6 |
7 #include <dwrite.h> | 7 #include <dwrite.h> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 base::string16 name; | 780 base::string16 name; |
781 base::string16 value; | 781 base::string16 value; |
782 for (DWORD idx = 0; idx < regkey.GetValueCount(); idx++) { | 782 for (DWORD idx = 0; idx < regkey.GetValueCount(); idx++) { |
783 if (regkey.GetValueNameAt(idx, &name) == ERROR_SUCCESS && | 783 if (regkey.GetValueNameAt(idx, &name) == ERROR_SUCCESS && |
784 regkey.ReadValue(name.c_str(), &value) == ERROR_SUCCESS) { | 784 regkey.ReadValue(name.c_str(), &value) == ERROR_SUCCESS) { |
785 base::FilePath path(value.c_str()); | 785 base::FilePath path(value.c_str()); |
786 // We need to check if file name is the only component that exists, | 786 // We need to check if file name is the only component that exists, |
787 // we will ignore all other registry entries. | 787 // we will ignore all other registry entries. |
788 std::vector<base::FilePath::StringType> components; | 788 std::vector<base::FilePath::StringType> components; |
789 path.GetComponents(&components); | 789 path.GetComponents(&components); |
790 if ((components.size() == 1 && | 790 if (components.size() == 1 || |
791 value.size() < kMaxFontFileNameLength - 1) || | |
792 base::FilePath::CompareEqualIgnoreCase(system_font_path.value(), | 791 base::FilePath::CompareEqualIgnoreCase(system_font_path.value(), |
793 path.DirName().value())) { | 792 path.DirName().value())) { |
794 bool should_ignore = false; | 793 bool should_ignore = false; |
795 for (const auto& ignore : kFontsToIgnore) { | 794 for (const auto& ignore : kFontsToIgnore) { |
796 if (base::FilePath::CompareEqualIgnoreCase(path.value(), ignore)) { | 795 if (base::FilePath::CompareEqualIgnoreCase(path.value(), ignore)) { |
797 should_ignore = true; | 796 should_ignore = true; |
798 break; | 797 break; |
799 } | 798 } |
800 } | 799 } |
801 if (!should_ignore) | 800 if (!should_ignore) |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 g_shared_font_cache.Set(mapping); | 1202 g_shared_font_cache.Set(mapping); |
1204 | 1203 |
1205 return true; | 1204 return true; |
1206 } | 1205 } |
1207 | 1206 |
1208 bool BuildFontCache(const base::FilePath& file) { | 1207 bool BuildFontCache(const base::FilePath& file) { |
1209 return BuildFontCacheInternal(file.value().c_str()); | 1208 return BuildFontCacheInternal(file.value().c_str()); |
1210 } | 1209 } |
1211 | 1210 |
1212 } // namespace content | 1211 } // namespace content |
OLD | NEW |