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 "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/task_runner_util.h" | 23 #include "base/task_runner_util.h" |
24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
25 #include "base/values.h" | 25 #include "base/values.h" |
26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/chromeos/customization_document.h" | 27 #include "chrome/browser/chromeos/customization_document.h" |
28 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 28 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 29 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" |
29 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
30 #include "chromeos/ime/component_extension_ime_manager.h" | 32 #include "chromeos/ime/component_extension_ime_manager.h" |
31 #include "chromeos/ime/input_method_descriptor.h" | 33 #include "chromeos/ime/input_method_descriptor.h" |
32 #include "chromeos/ime/input_method_manager.h" | 34 #include "chromeos/ime/input_method_manager.h" |
33 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
34 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
35 | 37 |
36 namespace chromeos { | 38 namespace chromeos { |
37 | 39 |
| 40 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER"; |
| 41 |
38 namespace { | 42 namespace { |
39 | 43 |
40 const char kSequenceToken[] = "chromeos_login_l10n_util"; | 44 const char kSequenceToken[] = "chromeos_login_l10n_util"; |
41 | 45 |
42 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( | 46 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( |
43 const input_method::InputMethodDescriptor& method, | 47 const input_method::InputMethodDescriptor& method, |
44 const std::string selected) { | 48 const std::string selected) { |
45 input_method::InputMethodUtil* util = | 49 input_method::InputMethodUtil* util = |
46 input_method::InputMethodManager::Get()->GetInputMethodUtil(); | 50 input_method::InputMethodManager::Get()->GetInputMethodUtil(); |
47 const std::string& ime_id = method.id(); | 51 const std::string& ime_id = method.id(); |
(...skipping 16 matching lines...) Expand all Loading... |
64 // TODO(dpolukhin): crbug.com/407579 | 68 // TODO(dpolukhin): crbug.com/407579 |
65 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) { | 69 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) { |
66 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue); | 70 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue); |
67 optgroup->SetString( | 71 optgroup->SetString( |
68 "optionGroupName", | 72 "optionGroupName", |
69 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS)); | 73 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS)); |
70 input_methods_list->Append(optgroup.release()); | 74 input_methods_list->Append(optgroup.release()); |
71 } | 75 } |
72 #endif | 76 #endif |
73 | 77 |
| 78 base::DictionaryValue* CreateLanguageEntry( |
| 79 const std::string& language_code, |
| 80 const base::string16& language_display_name, |
| 81 const base::string16& language_native_display_name) { |
| 82 base::string16 display_name = language_display_name; |
| 83 const bool markup_removal = |
| 84 base::i18n::UnadjustStringForLocaleDirection(&display_name); |
| 85 DCHECK(markup_removal); |
| 86 |
| 87 const bool has_rtl_chars = |
| 88 base::i18n::StringContainsStrongRTLChars(display_name); |
| 89 const std::string directionality = has_rtl_chars ? "rtl" : "ltr"; |
| 90 |
| 91 scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue()); |
| 92 dictionary->SetString("code", language_code); |
| 93 dictionary->SetString("displayName", language_display_name); |
| 94 dictionary->SetString("textDirection", directionality); |
| 95 dictionary->SetString("nativeDisplayName", language_native_display_name); |
| 96 return dictionary.release(); |
| 97 } |
| 98 |
74 // Gets the list of languages with |descriptors| based on |base_language_codes|. | 99 // Gets the list of languages with |descriptors| based on |base_language_codes|. |
75 // The |most_relevant_language_codes| will be first in the list. If | 100 // The |most_relevant_language_codes| will be first in the list. If |
76 // |insert_divider| is true, an entry with its "code" attribute set to | 101 // |insert_divider| is true, an entry with its "code" attribute set to |
77 // kMostRelevantLanguagesDivider is placed between the most relevant languages | 102 // kMostRelevantLanguagesDivider is placed between the most relevant languages |
78 // and all others. | 103 // and all others. |
79 scoped_ptr<base::ListValue> GetLanguageList( | 104 scoped_ptr<base::ListValue> GetLanguageList( |
80 const input_method::InputMethodDescriptors& descriptors, | 105 const input_method::InputMethodDescriptors& descriptors, |
81 const std::vector<std::string>& base_language_codes, | 106 const std::vector<std::string>& base_language_codes, |
82 const std::vector<std::string>& most_relevant_language_codes, | 107 const std::vector<std::string>& most_relevant_language_codes, |
83 bool insert_divider) { | 108 bool insert_divider) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 for (size_t i = 0; i < out_display_names.size(); ++i) { | 273 for (size_t i = 0; i < out_display_names.size(); ++i) { |
249 // Sets the directionality of the display language name. | 274 // Sets the directionality of the display language name. |
250 base::string16 display_name(out_display_names[i]); | 275 base::string16 display_name(out_display_names[i]); |
251 if (insert_divider && display_name == divider16) { | 276 if (insert_divider && display_name == divider16) { |
252 // Insert divider. | 277 // Insert divider. |
253 base::DictionaryValue* dictionary = new base::DictionaryValue(); | 278 base::DictionaryValue* dictionary = new base::DictionaryValue(); |
254 dictionary->SetString("code", kMostRelevantLanguagesDivider); | 279 dictionary->SetString("code", kMostRelevantLanguagesDivider); |
255 language_list->Append(dictionary); | 280 language_list->Append(dictionary); |
256 continue; | 281 continue; |
257 } | 282 } |
258 const bool markup_removal = | |
259 base::i18n::UnadjustStringForLocaleDirection(&display_name); | |
260 DCHECK(markup_removal); | |
261 const bool has_rtl_chars = | |
262 base::i18n::StringContainsStrongRTLChars(display_name); | |
263 const std::string directionality = has_rtl_chars ? "rtl" : "ltr"; | |
264 | 283 |
265 const LanguagePair& pair = language_map[out_display_names[i]]; | 284 const LanguagePair& pair = language_map[out_display_names[i]]; |
266 base::DictionaryValue* dictionary = new base::DictionaryValue(); | 285 language_list->Append( |
267 dictionary->SetString("code", pair.first); | 286 CreateLanguageEntry(pair.first, out_display_names[i], pair.second)); |
268 dictionary->SetString("displayName", out_display_names[i]); | |
269 dictionary->SetString("textDirection", directionality); | |
270 dictionary->SetString("nativeDisplayName", pair.second); | |
271 language_list->Append(dictionary); | |
272 } | 287 } |
273 | 288 |
274 return language_list.Pass(); | 289 return language_list.Pass(); |
275 } | 290 } |
276 | 291 |
277 // Invokes |callback| with a list of keyboard layouts that can be used for | 292 // Invokes |callback| with a list of keyboard layouts that can be used for |
278 // |resolved_locale|. | 293 // |resolved_locale|. |
279 void GetKeyboardLayoutsForResolvedLocale( | 294 void GetKeyboardLayoutsForResolvedLocale( |
280 const GetKeyboardLayoutsForLocaleCallback& callback, | 295 const GetKeyboardLayoutsForLocaleCallback& callback, |
281 const std::string& resolved_locale) { | 296 const std::string& resolved_locale) { |
(...skipping 22 matching lines...) Expand all Loading... |
304 util->GetInputMethodDescriptorFromId(*it); | 319 util->GetInputMethodDescriptorFromId(*it); |
305 if (!InsertString(ime->id(), &input_methods_added)) | 320 if (!InsertString(ime->id(), &input_methods_added)) |
306 continue; | 321 continue; |
307 input_methods_list->Append( | 322 input_methods_list->Append( |
308 CreateInputMethodsEntry(*ime, selected).release()); | 323 CreateInputMethodsEntry(*ime, selected).release()); |
309 } | 324 } |
310 | 325 |
311 callback.Run(input_methods_list.Pass()); | 326 callback.Run(input_methods_list.Pass()); |
312 } | 327 } |
313 | 328 |
314 } // namespace | 329 // For "UI Language" drop-down menu at OOBE screen we need to decide which |
| 330 // entry to mark "selected". If user has just selected "requested_locale", |
| 331 // but "loaded_locale" was actually loaded, we mark original user choice |
| 332 // "selected" only if loaded_locale is a backup for "requested_locale". |
| 333 std::string CalculateSelectedLanguage(const std::string& requested_locale, |
| 334 const std::string& loaded_locale) { |
| 335 std::string resolved_locale; |
| 336 if (!l10n_util::CheckAndResolveLocale(requested_locale, &resolved_locale)) |
| 337 return loaded_locale; |
315 | 338 |
316 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER"; | 339 if (resolved_locale == loaded_locale) |
| 340 return requested_locale; |
317 | 341 |
318 scoped_ptr<base::ListValue> GetUILanguageList( | 342 return loaded_locale; |
319 const std::vector<std::string>* most_relevant_language_codes, | 343 } |
320 const std::string& selected) { | |
321 ComponentExtensionIMEManager* manager = | |
322 input_method::InputMethodManager::Get()-> | |
323 GetComponentExtensionIMEManager(); | |
324 input_method::InputMethodDescriptors descriptors = | |
325 manager->GetXkbIMEAsInputMethodDescriptor(); | |
326 scoped_ptr<base::ListValue> languages_list(GetLanguageList( | |
327 descriptors, | |
328 l10n_util::GetAvailableLocales(), | |
329 most_relevant_language_codes | |
330 ? *most_relevant_language_codes | |
331 : StartupCustomizationDocument::GetInstance()->configured_locales(), | |
332 true)); | |
333 | 344 |
| 345 void ResolveLanguageListOnBlockingPool( |
| 346 const chromeos::locale_util::LanguageSwitchResult* language_switch_result, |
| 347 scoped_ptr<base::ListValue>* list, |
| 348 std::string* list_locale, |
| 349 std::string* selected_language) { |
| 350 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 351 |
| 352 if (!language_switch_result) { |
| 353 *selected_language = |
| 354 StartupCustomizationDocument::GetInstance()->initial_locale_default(); |
| 355 } else { |
| 356 if (language_switch_result->success) { |
| 357 if (language_switch_result->requested_locale == |
| 358 language_switch_result->loaded_locale) { |
| 359 *selected_language = language_switch_result->requested_locale; |
| 360 } else { |
| 361 *selected_language = |
| 362 CalculateSelectedLanguage(language_switch_result->requested_locale, |
| 363 language_switch_result->loaded_locale); |
| 364 } |
| 365 } else { |
| 366 *selected_language = language_switch_result->loaded_locale; |
| 367 } |
| 368 } |
| 369 const std::string selected_code = |
| 370 selected_language->empty() ? g_browser_process->GetApplicationLocale() |
| 371 : *selected_language; |
| 372 |
| 373 *list_locale = language_switch_result |
| 374 ? language_switch_result->loaded_locale |
| 375 : g_browser_process->GetApplicationLocale(); |
| 376 list->reset(chromeos::GetUILanguageList(NULL, selected_code).release()); |
| 377 } |
| 378 |
| 379 void OnLanguageListResolved( |
| 380 UILanguageListResolvedCallback callback, |
| 381 scoped_ptr<scoped_ptr<base::ListValue>> new_language_list, |
| 382 scoped_ptr<std::string> new_language_list_locale, |
| 383 scoped_ptr<std::string> new_selected_language) { |
| 384 callback.Run(new_language_list->Pass(), |
| 385 *new_language_list_locale, |
| 386 *new_selected_language); |
| 387 } |
| 388 |
| 389 void AdjustUILanguageList(const std::string& selected, |
| 390 base::ListValue* languages_list) { |
334 for (size_t i = 0; i < languages_list->GetSize(); ++i) { | 391 for (size_t i = 0; i < languages_list->GetSize(); ++i) { |
335 base::DictionaryValue* language_info = NULL; | 392 base::DictionaryValue* language_info = NULL; |
336 if (!languages_list->GetDictionary(i, &language_info)) | 393 if (!languages_list->GetDictionary(i, &language_info)) |
337 NOTREACHED(); | 394 NOTREACHED(); |
338 | 395 |
339 std::string value; | 396 std::string value; |
340 language_info->GetString("code", &value); | 397 language_info->GetString("code", &value); |
341 std::string display_name; | 398 std::string display_name; |
342 language_info->GetString("displayName", &display_name); | 399 language_info->GetString("displayName", &display_name); |
343 std::string native_name; | 400 std::string native_name; |
344 language_info->GetString("nativeDisplayName", &native_name); | 401 language_info->GetString("nativeDisplayName", &native_name); |
345 | 402 |
346 // If it's an option group divider, add field name. | 403 // If it's an option group divider, add field name. |
347 if (value == kMostRelevantLanguagesDivider) { | 404 if (value == kMostRelevantLanguagesDivider) { |
348 language_info->SetString( | 405 language_info->SetString( |
349 "optionGroupName", | 406 "optionGroupName", |
350 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_LANGUAGES)); | 407 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_LANGUAGES)); |
351 } | 408 } |
352 if (display_name != native_name) { | 409 if (display_name != native_name) { |
353 display_name = base::StringPrintf("%s - %s", | 410 display_name = base::StringPrintf("%s - %s", |
354 display_name.c_str(), | 411 display_name.c_str(), |
355 native_name.c_str()); | 412 native_name.c_str()); |
356 } | 413 } |
357 | 414 |
358 language_info->SetString("value", value); | 415 language_info->SetString("value", value); |
359 language_info->SetString("title", display_name); | 416 language_info->SetString("title", display_name); |
360 if (value == selected) | 417 if (value == selected) |
361 language_info->SetBoolean("selected", true); | 418 language_info->SetBoolean("selected", true); |
362 } | 419 } |
| 420 } |
| 421 |
| 422 } // namespace |
| 423 |
| 424 void ResolveUILanguageList( |
| 425 scoped_ptr<chromeos::locale_util::LanguageSwitchResult> |
| 426 language_switch_result, |
| 427 UILanguageListResolvedCallback callback) { |
| 428 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 429 |
| 430 scoped_ptr<scoped_ptr<base::ListValue>> new_language_list( |
| 431 new scoped_ptr<base::ListValue>()); |
| 432 scoped_ptr<std::string> new_language_list_locale(new std::string); |
| 433 scoped_ptr<std::string> new_selected_language(new std::string); |
| 434 |
| 435 base::Closure resolve_on_pool = |
| 436 base::Bind(&ResolveLanguageListOnBlockingPool, |
| 437 base::Owned(language_switch_result.release()), |
| 438 base::Unretained(new_language_list.get()), |
| 439 base::Unretained(new_language_list_locale.get()), |
| 440 base::Unretained(new_selected_language.get())); |
| 441 |
| 442 base::Closure on_language_list_resolved = |
| 443 base::Bind(&OnLanguageListResolved, |
| 444 callback, |
| 445 base::Passed(new_language_list.Pass()), |
| 446 base::Passed(new_language_list_locale.Pass()), |
| 447 base::Passed(new_selected_language.Pass())); |
| 448 |
| 449 content::BrowserThread::GetBlockingPool()->PostTaskAndReply( |
| 450 FROM_HERE, resolve_on_pool, on_language_list_resolved); |
| 451 } |
| 452 |
| 453 scoped_ptr<base::ListValue> GetMinimalUILanguageList() { |
| 454 const std::string application_locale = |
| 455 g_browser_process->GetApplicationLocale(); |
| 456 base::string16 language_native_display_name = |
| 457 l10n_util::GetDisplayNameForLocale( |
| 458 application_locale, application_locale, true); |
| 459 |
| 460 scoped_ptr<base::ListValue> language_list(new base::ListValue()); |
| 461 language_list->Append(CreateLanguageEntry(application_locale, |
| 462 language_native_display_name, |
| 463 language_native_display_name)); |
| 464 AdjustUILanguageList(std::string(), language_list.get()); |
| 465 return language_list.Pass(); |
| 466 } |
| 467 |
| 468 scoped_ptr<base::ListValue> GetUILanguageList( |
| 469 const std::vector<std::string>* most_relevant_language_codes, |
| 470 const std::string& selected) { |
| 471 ComponentExtensionIMEManager* manager = |
| 472 input_method::InputMethodManager::Get() |
| 473 ->GetComponentExtensionIMEManager(); |
| 474 input_method::InputMethodDescriptors descriptors = |
| 475 manager->GetXkbIMEAsInputMethodDescriptor(); |
| 476 scoped_ptr<base::ListValue> languages_list(GetLanguageList( |
| 477 descriptors, |
| 478 l10n_util::GetAvailableLocales(), |
| 479 most_relevant_language_codes |
| 480 ? *most_relevant_language_codes |
| 481 : StartupCustomizationDocument::GetInstance()->configured_locales(), |
| 482 true)); |
| 483 AdjustUILanguageList(selected, languages_list.get()); |
363 return languages_list.Pass(); | 484 return languages_list.Pass(); |
364 } | 485 } |
365 | 486 |
366 std::string FindMostRelevantLocale( | 487 std::string FindMostRelevantLocale( |
367 const std::vector<std::string>& most_relevant_language_codes, | 488 const std::vector<std::string>& most_relevant_language_codes, |
368 const base::ListValue& available_locales, | 489 const base::ListValue& available_locales, |
369 const std::string& fallback_locale) { | 490 const std::string& fallback_locale) { |
370 for (std::vector<std::string>::const_iterator most_relevant_it = | 491 for (std::vector<std::string>::const_iterator most_relevant_it = |
371 most_relevant_language_codes.begin(); | 492 most_relevant_language_codes.begin(); |
372 most_relevant_it != most_relevant_language_codes.end(); | 493 most_relevant_it != most_relevant_language_codes.end(); |
(...skipping 23 matching lines...) Expand all Loading... |
396 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); | 517 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); |
397 return GetLanguageList( | 518 return GetLanguageList( |
398 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), | 519 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), |
399 accept_language_codes, | 520 accept_language_codes, |
400 StartupCustomizationDocument::GetInstance()->configured_locales(), | 521 StartupCustomizationDocument::GetInstance()->configured_locales(), |
401 false); | 522 false); |
402 } | 523 } |
403 | 524 |
404 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( | 525 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( |
405 const std::string& locale, | 526 const std::string& locale, |
406 const std::string& selected) { | 527 const std::string& selected, |
| 528 bool activate_keyboards) { |
407 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); | 529 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); |
408 #if !defined(USE_ATHENA) | 530 #if !defined(USE_ATHENA) |
409 // TODO(dpolukhin): crbug.com/407579 | 531 // TODO(dpolukhin): crbug.com/407579 |
410 input_method::InputMethodManager* manager = | 532 input_method::InputMethodManager* manager = |
411 input_method::InputMethodManager::Get(); | 533 input_method::InputMethodManager::Get(); |
412 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 534 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
413 | 535 |
414 const std::vector<std::string>& hardware_login_input_methods = | 536 const std::vector<std::string>& hardware_login_input_methods = |
415 util->GetHardwareLoginInputMethodIds(); | 537 util->GetHardwareLoginInputMethodIds(); |
416 | 538 |
417 manager->GetActiveIMEState()->EnableLoginLayouts( | 539 if (activate_keyboards) { |
418 locale, hardware_login_input_methods); | 540 DCHECK( |
| 541 ProfileHelper::IsSigninProfile(ProfileManager::GetActiveUserProfile())); |
| 542 manager->GetActiveIMEState()->EnableLoginLayouts( |
| 543 locale, hardware_login_input_methods); |
| 544 } |
419 | 545 |
420 scoped_ptr<input_method::InputMethodDescriptors> input_methods( | 546 scoped_ptr<input_method::InputMethodDescriptors> input_methods( |
421 manager->GetActiveIMEState()->GetActiveInputMethods()); | 547 manager->GetActiveIMEState()->GetActiveInputMethods()); |
422 std::set<std::string> input_methods_added; | 548 std::set<std::string> input_methods_added; |
423 | 549 |
424 for (std::vector<std::string>::const_iterator i = | 550 for (std::vector<std::string>::const_iterator i = |
425 hardware_login_input_methods.begin(); | 551 hardware_login_input_methods.begin(); |
426 i != hardware_login_input_methods.end(); | 552 i != hardware_login_input_methods.end(); |
427 ++i) { | 553 ++i) { |
428 const input_method::InputMethodDescriptor* ime = | 554 const input_method::InputMethodDescriptor* ime = |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 619 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
494 const input_method::InputMethodDescriptor current_input_method = | 620 const input_method::InputMethodDescriptor current_input_method = |
495 input_method::InputMethodManager::Get() | 621 input_method::InputMethodManager::Get() |
496 ->GetActiveIMEState() | 622 ->GetActiveIMEState() |
497 ->GetCurrentInputMethod(); | 623 ->GetCurrentInputMethod(); |
498 return CreateInputMethodsEntry(current_input_method, | 624 return CreateInputMethodsEntry(current_input_method, |
499 current_input_method.id()); | 625 current_input_method.id()); |
500 } | 626 } |
501 | 627 |
502 } // namespace chromeos | 628 } // namespace chromeos |
OLD | NEW |