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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 10532105: Use ICU script code "Jpan" instead of "Hrkt" in Japanese pref names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better sample texts Created 8 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 | Annotate | Revision Log
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 "chrome/browser/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include "base/string_split.h" 7 #include "base/string_split.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 prefs::kWebKitMinimumLogicalFontSize, 104 prefs::kWebKitMinimumLogicalFontSize,
105 prefs::kWebKitPluginsEnabled, 105 prefs::kWebKitPluginsEnabled,
106 prefs::kWebkitTabsToLinks, 106 prefs::kWebkitTabsToLinks,
107 prefs::kWebKitUsesUniversalDetector 107 prefs::kWebKitUsesUniversalDetector
108 }; 108 };
109 109
110 const int kPrefsToObserveLength = arraysize(kPrefsToObserve); 110 const int kPrefsToObserveLength = arraysize(kPrefsToObserve);
111 111
112 // Registers a preference under the path |map_name| for each script used for 112 // Registers a preference under the path |map_name| for each script used for
113 // per-script font prefs. For example, if |map_name| is "fonts.serif", then 113 // per-script font prefs. For example, if |map_name| is "fonts.serif", then
114 // "fonts.serif.Arab", "fonts.serif.Hang", etc. are registered. 114 // "fonts.serif.Arab", "fonts.serif.Kore", etc. are registered.
jungshik at Google 2012/06/14 21:49:47 Leave alone 'Hang' and exclude 'Kore'.
falken 2012/06/15 03:58:11 Done.
115 void RegisterFontFamilyMap(PrefService* prefs, const char* map_name) { 115 void RegisterFontFamilyMap(PrefService* prefs, const char* map_name) {
116 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { 116 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) {
117 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; 117 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i];
118 std::string pref_name_str = base::StringPrintf("%s.%s", map_name, script); 118 std::string pref_name_str = base::StringPrintf("%s.%s", map_name, script);
119 const char* pref_name = pref_name_str.c_str(); 119 const char* pref_name = pref_name_str.c_str();
120 if (!prefs->FindPreference(pref_name)) 120 if (!prefs->FindPreference(pref_name))
121 prefs->RegisterStringPref(pref_name, "", PrefService::UNSYNCABLE_PREF); 121 prefs->RegisterStringPref(pref_name, "", PrefService::UNSYNCABLE_PREF);
122 } 122 }
123 } 123 }
124 124
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 DCHECK_GT(len, kScriptNameLength); 217 DCHECK_GT(len, kScriptNameLength);
218 const char* scriptName = &pref_name[len - kScriptNameLength]; 218 const char* scriptName = &pref_name[len - kScriptNameLength];
219 int32 code = u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName); 219 int32 code = u_getPropertyValueEnum(UCHAR_SCRIPT, scriptName);
220 DCHECK(code >= 0 && code < USCRIPT_CODE_LIMIT); 220 DCHECK(code >= 0 && code < USCRIPT_CODE_LIMIT);
221 return static_cast<UScriptCode>(code); 221 return static_cast<UScriptCode>(code);
222 } 222 }
223 223
224 // If |scriptCode| is a member of a family of "similar" script codes, returns 224 // If |scriptCode| is a member of a family of "similar" script codes, returns
225 // the script code in that family that is used in font pref names. For example, 225 // the script code in that family that is used in font pref names. For example,
226 // USCRIPT_HANGUL and USCRIPT_KOREAN are considered equivalent for the purposes 226 // USCRIPT_HANGUL and USCRIPT_KOREAN are considered equivalent for the purposes
227 // of font selection. Chrome uses the script code USCRIPT_HANGUL (script name 227 // of font selection. Chrome uses the script code USCRIPT_KOREAN (script name
228 // "Hang") in Korean font pref names (for example, 228 // "Kore") in Korean font pref names (for example,
229 // "webkit.webprefs.fonts.serif.Hang"). So, if |scriptCode| is USCRIPT_KOREAN, 229 // "webkit.webprefs.fonts.serif.Kore"). So, if |scriptCode| is USCRIPT_HANGUL,
230 // the function returns USCRIPT_HANGUL. If |scriptCode| is not a member of such 230 // the function returns USCRIPT_KOREAN. If |scriptCode| is not a member of such
231 // a family, returns |scriptCode|. 231 // a family, returns |scriptCode|.
232 UScriptCode GetScriptForFontPrefMatching(UScriptCode scriptCode) { 232 UScriptCode GetScriptForFontPrefMatching(UScriptCode scriptCode) {
233 switch (scriptCode) { 233 switch (scriptCode) {
234 case USCRIPT_HIRAGANA: 234 case USCRIPT_HIRAGANA:
235 case USCRIPT_KATAKANA: 235 case USCRIPT_KATAKANA:
236 case USCRIPT_JAPANESE: 236 case USCRIPT_KATAKANA_OR_HIRAGANA:
237 return USCRIPT_KATAKANA_OR_HIRAGANA; 237 return USCRIPT_JAPANESE;
238 case USCRIPT_KOREAN: 238 case USCRIPT_HANGUL:
239 return USCRIPT_HANGUL; 239 return USCRIPT_KOREAN;
jungshik at Google 2012/06/14 21:49:47 Perhaps, Kore -> Hang mapping makes more sense.
falken 2012/06/15 03:58:11 Done.
240 default: 240 default:
241 return scriptCode; 241 return scriptCode;
242 } 242 }
243 } 243 }
244 244
245 // Returns the primary script used by the browser's UI locale. For example, if 245 // Returns the primary script used by the browser's UI locale. For example, if
246 // the locale is "ru", the function returns USCRIPT_CYRILLIC, and if the locale 246 // the locale is "ru", the function returns USCRIPT_CYRILLIC, and if the locale
247 // is "en", the function returns USCRIPT_LATIN. 247 // is "en", the function returns USCRIPT_LATIN.
248 UScriptCode GetScriptOfBrowserLocale() { 248 UScriptCode GetScriptOfBrowserLocale() {
249 std::string locale = g_browser_process->GetApplicationLocale(); 249 std::string locale = g_browser_process->GetApplicationLocale();
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 void PrefsTabHelper::UpdateRendererPreferences() { 531 void PrefsTabHelper::UpdateRendererPreferences() {
532 renderer_preferences_util::UpdateFromSystemSettings( 532 renderer_preferences_util::UpdateFromSystemSettings(
533 web_contents_->GetMutableRendererPrefs(), GetProfile()); 533 web_contents_->GetMutableRendererPrefs(), GetProfile());
534 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 534 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
535 } 535 }
536 536
537 Profile* PrefsTabHelper::GetProfile() { 537 Profile* PrefsTabHelper::GetProfile() {
538 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 538 return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
539 } 539 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698