OLD | NEW |
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 "chrome/browser/ui/prefs/prefs_tab_helper.h" | 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 UScriptCode browser_script = GetScriptOfBrowserLocale(); | 554 UScriptCode browser_script = GetScriptOfBrowserLocale(); |
555 for (size_t i = 0; i < kFontDefaultsLength; ++i) { | 555 for (size_t i = 0; i < kFontDefaultsLength; ++i) { |
556 FontDefault pref = kFontDefaults[i]; | 556 FontDefault pref = kFontDefaults[i]; |
557 | 557 |
558 #if defined(OS_WIN) | 558 #if defined(OS_WIN) |
559 if (pref.pref_name == prefs::kWebKitFixedFontFamily) { | 559 if (pref.pref_name == prefs::kWebKitFixedFontFamily) { |
560 if (ShouldUseAlternateDefaultFixedFont( | 560 if (ShouldUseAlternateDefaultFixedFont( |
561 l10n_util::GetStringUTF8(pref.resource_id))) | 561 l10n_util::GetStringUTF8(pref.resource_id))) |
562 pref.resource_id = IDS_FIXED_FONT_FAMILY_ALT_WIN; | 562 pref.resource_id = IDS_FIXED_FONT_FAMILY_ALT_WIN; |
563 } | 563 } |
| 564 |
| 565 // The standard font (Meiryo) isn't installed by default as of Win 10. |
| 566 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
| 567 if (pref.pref_name == prefs::kWebKitStandardFontFamilyJapanese) { |
| 568 pref.resource_id = IDS_STANDARD_FONT_FAMILY_JAPANESE_ALT_WIN; |
| 569 } else if (pref.pref_name == prefs::kWebKitSansSerifFontFamilyJapanese) { |
| 570 pref.resource_id = IDS_SANS_SERIF_FONT_FAMILY_JAPANESE_ALT_WIN; |
| 571 } |
| 572 } |
564 #endif | 573 #endif |
565 | 574 |
566 UScriptCode pref_script = GetScriptOfFontPref(pref.pref_name); | 575 UScriptCode pref_script = GetScriptOfFontPref(pref.pref_name); |
567 | 576 |
568 // Suppress this default font pref value if it is for the primary script of | 577 // Suppress this default font pref value if it is for the primary script of |
569 // the browser's UI locale. For example, if the pref is for the sans-serif | 578 // the browser's UI locale. For example, if the pref is for the sans-serif |
570 // font for the Cyrillic script, and the browser locale is "ru" (Russian), | 579 // font for the Cyrillic script, and the browser locale is "ru" (Russian), |
571 // the default is suppressed. Otherwise, the default would override the | 580 // the default is suppressed. Otherwise, the default would override the |
572 // user's font preferences when viewing pages in their native language. | 581 // user's font preferences when viewing pages in their native language. |
573 // This is because users have no way yet of customizing their per-script | 582 // This is because users have no way yet of customizing their per-script |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 685 } |
677 } | 686 } |
678 | 687 |
679 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { | 688 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { |
680 #if !defined(OS_ANDROID) | 689 #if !defined(OS_ANDROID) |
681 OnFontFamilyPrefChanged(pref_name); | 690 OnFontFamilyPrefChanged(pref_name); |
682 #endif | 691 #endif |
683 | 692 |
684 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); | 693 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); |
685 } | 694 } |
OLD | NEW |