| 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" | |
| 31 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 32 #include "chromeos/ime/component_extension_ime_manager.h" | 30 #include "chromeos/ime/component_extension_ime_manager.h" |
| 33 #include "chromeos/ime/input_method_descriptor.h" | 31 #include "chromeos/ime/input_method_descriptor.h" |
| 34 #include "chromeos/ime/input_method_manager.h" | 32 #include "chromeos/ime/input_method_manager.h" |
| 35 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 37 | 35 |
| 38 namespace chromeos { | 36 namespace chromeos { |
| 39 | 37 |
| 40 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER"; | |
| 41 | |
| 42 namespace { | 38 namespace { |
| 43 | 39 |
| 44 const char kSequenceToken[] = "chromeos_login_l10n_util"; | 40 const char kSequenceToken[] = "chromeos_login_l10n_util"; |
| 45 | 41 |
| 46 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( | 42 scoped_ptr<base::DictionaryValue> CreateInputMethodsEntry( |
| 47 const input_method::InputMethodDescriptor& method, | 43 const input_method::InputMethodDescriptor& method, |
| 48 const std::string selected) { | 44 const std::string selected) { |
| 49 input_method::InputMethodUtil* util = | 45 input_method::InputMethodUtil* util = |
| 50 input_method::InputMethodManager::Get()->GetInputMethodUtil(); | 46 input_method::InputMethodManager::Get()->GetInputMethodUtil(); |
| 51 const std::string& ime_id = method.id(); | 47 const std::string& ime_id = method.id(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 // TODO(dpolukhin): crbug.com/407579 | 64 // TODO(dpolukhin): crbug.com/407579 |
| 69 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) { | 65 void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) { |
| 70 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue); | 66 scoped_ptr<base::DictionaryValue> optgroup(new base::DictionaryValue); |
| 71 optgroup->SetString( | 67 optgroup->SetString( |
| 72 "optionGroupName", | 68 "optionGroupName", |
| 73 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS)); | 69 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS)); |
| 74 input_methods_list->Append(optgroup.release()); | 70 input_methods_list->Append(optgroup.release()); |
| 75 } | 71 } |
| 76 #endif | 72 #endif |
| 77 | 73 |
| 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 | |
| 99 // Gets the list of languages with |descriptors| based on |base_language_codes|. | 74 // Gets the list of languages with |descriptors| based on |base_language_codes|. |
| 100 // The |most_relevant_language_codes| will be first in the list. If | 75 // The |most_relevant_language_codes| will be first in the list. If |
| 101 // |insert_divider| is true, an entry with its "code" attribute set to | 76 // |insert_divider| is true, an entry with its "code" attribute set to |
| 102 // kMostRelevantLanguagesDivider is placed between the most relevant languages | 77 // kMostRelevantLanguagesDivider is placed between the most relevant languages |
| 103 // and all others. | 78 // and all others. |
| 104 scoped_ptr<base::ListValue> GetLanguageList( | 79 scoped_ptr<base::ListValue> GetLanguageList( |
| 105 const input_method::InputMethodDescriptors& descriptors, | 80 const input_method::InputMethodDescriptors& descriptors, |
| 106 const std::vector<std::string>& base_language_codes, | 81 const std::vector<std::string>& base_language_codes, |
| 107 const std::vector<std::string>& most_relevant_language_codes, | 82 const std::vector<std::string>& most_relevant_language_codes, |
| 108 bool insert_divider) { | 83 bool insert_divider) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 for (size_t i = 0; i < out_display_names.size(); ++i) { | 248 for (size_t i = 0; i < out_display_names.size(); ++i) { |
| 274 // Sets the directionality of the display language name. | 249 // Sets the directionality of the display language name. |
| 275 base::string16 display_name(out_display_names[i]); | 250 base::string16 display_name(out_display_names[i]); |
| 276 if (insert_divider && display_name == divider16) { | 251 if (insert_divider && display_name == divider16) { |
| 277 // Insert divider. | 252 // Insert divider. |
| 278 base::DictionaryValue* dictionary = new base::DictionaryValue(); | 253 base::DictionaryValue* dictionary = new base::DictionaryValue(); |
| 279 dictionary->SetString("code", kMostRelevantLanguagesDivider); | 254 dictionary->SetString("code", kMostRelevantLanguagesDivider); |
| 280 language_list->Append(dictionary); | 255 language_list->Append(dictionary); |
| 281 continue; | 256 continue; |
| 282 } | 257 } |
| 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"; |
| 283 | 264 |
| 284 const LanguagePair& pair = language_map[out_display_names[i]]; | 265 const LanguagePair& pair = language_map[out_display_names[i]]; |
| 285 language_list->Append( | 266 base::DictionaryValue* dictionary = new base::DictionaryValue(); |
| 286 CreateLanguageEntry(pair.first, out_display_names[i], pair.second)); | 267 dictionary->SetString("code", pair.first); |
| 268 dictionary->SetString("displayName", out_display_names[i]); |
| 269 dictionary->SetString("textDirection", directionality); |
| 270 dictionary->SetString("nativeDisplayName", pair.second); |
| 271 language_list->Append(dictionary); |
| 287 } | 272 } |
| 288 | 273 |
| 289 return language_list.Pass(); | 274 return language_list.Pass(); |
| 290 } | 275 } |
| 291 | 276 |
| 292 // Invokes |callback| with a list of keyboard layouts that can be used for | 277 // Invokes |callback| with a list of keyboard layouts that can be used for |
| 293 // |resolved_locale|. | 278 // |resolved_locale|. |
| 294 void GetKeyboardLayoutsForResolvedLocale( | 279 void GetKeyboardLayoutsForResolvedLocale( |
| 295 const GetKeyboardLayoutsForLocaleCallback& callback, | 280 const GetKeyboardLayoutsForLocaleCallback& callback, |
| 296 const std::string& resolved_locale) { | 281 const std::string& resolved_locale) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 319 util->GetInputMethodDescriptorFromId(*it); | 304 util->GetInputMethodDescriptorFromId(*it); |
| 320 if (!InsertString(ime->id(), &input_methods_added)) | 305 if (!InsertString(ime->id(), &input_methods_added)) |
| 321 continue; | 306 continue; |
| 322 input_methods_list->Append( | 307 input_methods_list->Append( |
| 323 CreateInputMethodsEntry(*ime, selected).release()); | 308 CreateInputMethodsEntry(*ime, selected).release()); |
| 324 } | 309 } |
| 325 | 310 |
| 326 callback.Run(input_methods_list.Pass()); | 311 callback.Run(input_methods_list.Pass()); |
| 327 } | 312 } |
| 328 | 313 |
| 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; | |
| 338 | |
| 339 if (resolved_locale == loaded_locale) | |
| 340 return requested_locale; | |
| 341 | |
| 342 return loaded_locale; | |
| 343 } | |
| 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) { | |
| 391 for (size_t i = 0; i < languages_list->GetSize(); ++i) { | |
| 392 base::DictionaryValue* language_info = NULL; | |
| 393 if (!languages_list->GetDictionary(i, &language_info)) | |
| 394 NOTREACHED(); | |
| 395 | |
| 396 std::string value; | |
| 397 language_info->GetString("code", &value); | |
| 398 std::string display_name; | |
| 399 language_info->GetString("displayName", &display_name); | |
| 400 std::string native_name; | |
| 401 language_info->GetString("nativeDisplayName", &native_name); | |
| 402 | |
| 403 // If it's an option group divider, add field name. | |
| 404 if (value == kMostRelevantLanguagesDivider) { | |
| 405 language_info->SetString( | |
| 406 "optionGroupName", | |
| 407 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_LANGUAGES)); | |
| 408 } | |
| 409 if (display_name != native_name) { | |
| 410 display_name = base::StringPrintf("%s - %s", | |
| 411 display_name.c_str(), | |
| 412 native_name.c_str()); | |
| 413 } | |
| 414 | |
| 415 language_info->SetString("value", value); | |
| 416 language_info->SetString("title", display_name); | |
| 417 if (value == selected) | |
| 418 language_info->SetBoolean("selected", true); | |
| 419 } | |
| 420 } | |
| 421 | |
| 422 } // namespace | 314 } // namespace |
| 423 | 315 |
| 424 void ResolveUILanguageList( | 316 const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER"; |
| 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 content::BrowserThread::GetBlockingPool()->PostTaskAndReply( | |
| 436 FROM_HERE, | |
| 437 base::Bind(&ResolveLanguageListOnBlockingPool, | |
| 438 base::Owned(language_switch_result.release()), | |
| 439 base::Unretained(new_language_list.get()), | |
| 440 base::Unretained(new_language_list_locale.get()), | |
| 441 base::Unretained(new_selected_language.get())), | |
| 442 base::Bind(&OnLanguageListResolved, | |
| 443 callback, | |
| 444 base::Passed(new_language_list.Pass()), | |
| 445 base::Passed(new_language_list_locale.Pass()), | |
| 446 base::Passed(new_selected_language.Pass()))); | |
| 447 } | |
| 448 | |
| 449 scoped_ptr<base::ListValue> GetMinimalUILanguageList() { | |
| 450 const std::string application_locale = | |
| 451 g_browser_process->GetApplicationLocale(); | |
| 452 base::string16 language_native_display_name = | |
| 453 l10n_util::GetDisplayNameForLocale( | |
| 454 application_locale, application_locale, true); | |
| 455 | |
| 456 scoped_ptr<base::ListValue> language_list(new base::ListValue()); | |
| 457 language_list->Append(CreateLanguageEntry(application_locale, | |
| 458 language_native_display_name, | |
| 459 language_native_display_name)); | |
| 460 AdjustUILanguageList(std::string(), language_list.get()); | |
| 461 return language_list.Pass(); | |
| 462 } | |
| 463 | 317 |
| 464 scoped_ptr<base::ListValue> GetUILanguageList( | 318 scoped_ptr<base::ListValue> GetUILanguageList( |
| 465 const std::vector<std::string>* most_relevant_language_codes, | 319 const std::vector<std::string>* most_relevant_language_codes, |
| 466 const std::string& selected) { | 320 const std::string& selected) { |
| 467 ComponentExtensionIMEManager* manager = | 321 ComponentExtensionIMEManager* manager = |
| 468 input_method::InputMethodManager::Get() | 322 input_method::InputMethodManager::Get()-> |
| 469 ->GetComponentExtensionIMEManager(); | 323 GetComponentExtensionIMEManager(); |
| 470 input_method::InputMethodDescriptors descriptors = | 324 input_method::InputMethodDescriptors descriptors = |
| 471 manager->GetXkbIMEAsInputMethodDescriptor(); | 325 manager->GetXkbIMEAsInputMethodDescriptor(); |
| 472 scoped_ptr<base::ListValue> languages_list(GetLanguageList( | 326 scoped_ptr<base::ListValue> languages_list(GetLanguageList( |
| 473 descriptors, | 327 descriptors, |
| 474 l10n_util::GetAvailableLocales(), | 328 l10n_util::GetAvailableLocales(), |
| 475 most_relevant_language_codes | 329 most_relevant_language_codes |
| 476 ? *most_relevant_language_codes | 330 ? *most_relevant_language_codes |
| 477 : StartupCustomizationDocument::GetInstance()->configured_locales(), | 331 : StartupCustomizationDocument::GetInstance()->configured_locales(), |
| 478 true)); | 332 true)); |
| 479 AdjustUILanguageList(selected, languages_list.get()); | 333 |
| 334 for (size_t i = 0; i < languages_list->GetSize(); ++i) { |
| 335 base::DictionaryValue* language_info = NULL; |
| 336 if (!languages_list->GetDictionary(i, &language_info)) |
| 337 NOTREACHED(); |
| 338 |
| 339 std::string value; |
| 340 language_info->GetString("code", &value); |
| 341 std::string display_name; |
| 342 language_info->GetString("displayName", &display_name); |
| 343 std::string native_name; |
| 344 language_info->GetString("nativeDisplayName", &native_name); |
| 345 |
| 346 // If it's an option group divider, add field name. |
| 347 if (value == kMostRelevantLanguagesDivider) { |
| 348 language_info->SetString( |
| 349 "optionGroupName", |
| 350 l10n_util::GetStringUTF16(IDS_OOBE_OTHER_LANGUAGES)); |
| 351 } |
| 352 if (display_name != native_name) { |
| 353 display_name = base::StringPrintf("%s - %s", |
| 354 display_name.c_str(), |
| 355 native_name.c_str()); |
| 356 } |
| 357 |
| 358 language_info->SetString("value", value); |
| 359 language_info->SetString("title", display_name); |
| 360 if (value == selected) |
| 361 language_info->SetBoolean("selected", true); |
| 362 } |
| 480 return languages_list.Pass(); | 363 return languages_list.Pass(); |
| 481 } | 364 } |
| 482 | 365 |
| 483 std::string FindMostRelevantLocale( | 366 std::string FindMostRelevantLocale( |
| 484 const std::vector<std::string>& most_relevant_language_codes, | 367 const std::vector<std::string>& most_relevant_language_codes, |
| 485 const base::ListValue& available_locales, | 368 const base::ListValue& available_locales, |
| 486 const std::string& fallback_locale) { | 369 const std::string& fallback_locale) { |
| 487 for (std::vector<std::string>::const_iterator most_relevant_it = | 370 for (std::vector<std::string>::const_iterator most_relevant_it = |
| 488 most_relevant_language_codes.begin(); | 371 most_relevant_language_codes.begin(); |
| 489 most_relevant_it != most_relevant_language_codes.end(); | 372 most_relevant_it != most_relevant_language_codes.end(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 513 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); | 396 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); |
| 514 return GetLanguageList( | 397 return GetLanguageList( |
| 515 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), | 398 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), |
| 516 accept_language_codes, | 399 accept_language_codes, |
| 517 StartupCustomizationDocument::GetInstance()->configured_locales(), | 400 StartupCustomizationDocument::GetInstance()->configured_locales(), |
| 518 false); | 401 false); |
| 519 } | 402 } |
| 520 | 403 |
| 521 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( | 404 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( |
| 522 const std::string& locale, | 405 const std::string& locale, |
| 523 const std::string& selected, | 406 const std::string& selected) { |
| 524 bool activate_keyboards) { | |
| 525 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); | 407 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); |
| 526 #if !defined(USE_ATHENA) | 408 #if !defined(USE_ATHENA) |
| 527 // TODO(dpolukhin): crbug.com/407579 | 409 // TODO(dpolukhin): crbug.com/407579 |
| 528 input_method::InputMethodManager* manager = | 410 input_method::InputMethodManager* manager = |
| 529 input_method::InputMethodManager::Get(); | 411 input_method::InputMethodManager::Get(); |
| 530 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 412 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
| 531 | 413 |
| 532 const std::vector<std::string>& hardware_login_input_methods = | 414 const std::vector<std::string>& hardware_login_input_methods = |
| 533 util->GetHardwareLoginInputMethodIds(); | 415 util->GetHardwareLoginInputMethodIds(); |
| 534 | 416 |
| 535 if (activate_keyboards) { | 417 manager->GetActiveIMEState()->EnableLoginLayouts( |
| 536 DCHECK( | 418 locale, hardware_login_input_methods); |
| 537 ProfileHelper::IsSigninProfile(ProfileManager::GetActiveUserProfile())); | |
| 538 manager->GetActiveIMEState()->EnableLoginLayouts( | |
| 539 locale, hardware_login_input_methods); | |
| 540 } | |
| 541 | 419 |
| 542 scoped_ptr<input_method::InputMethodDescriptors> input_methods( | 420 scoped_ptr<input_method::InputMethodDescriptors> input_methods( |
| 543 manager->GetActiveIMEState()->GetActiveInputMethods()); | 421 manager->GetActiveIMEState()->GetActiveInputMethods()); |
| 544 std::set<std::string> input_methods_added; | 422 std::set<std::string> input_methods_added; |
| 545 | 423 |
| 546 for (std::vector<std::string>::const_iterator i = | 424 for (std::vector<std::string>::const_iterator i = |
| 547 hardware_login_input_methods.begin(); | 425 hardware_login_input_methods.begin(); |
| 548 i != hardware_login_input_methods.end(); | 426 i != hardware_login_input_methods.end(); |
| 549 ++i) { | 427 ++i) { |
| 550 const input_method::InputMethodDescriptor* ime = | 428 const input_method::InputMethodDescriptor* ime = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 493 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
| 616 const input_method::InputMethodDescriptor current_input_method = | 494 const input_method::InputMethodDescriptor current_input_method = |
| 617 input_method::InputMethodManager::Get() | 495 input_method::InputMethodManager::Get() |
| 618 ->GetActiveIMEState() | 496 ->GetActiveIMEState() |
| 619 ->GetCurrentInputMethod(); | 497 ->GetCurrentInputMethod(); |
| 620 return CreateInputMethodsEntry(current_input_method, | 498 return CreateInputMethodsEntry(current_input_method, |
| 621 current_input_method.id()); | 499 current_input_method.id()); |
| 622 } | 500 } |
| 623 | 501 |
| 624 } // namespace chromeos | 502 } // namespace chromeos |
| OLD | NEW |