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/webui/chromeos/login/network_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 core_oobe_actor_(core_oobe_actor), | 84 core_oobe_actor_(core_oobe_actor), |
85 is_continue_enabled_(false), | 85 is_continue_enabled_(false), |
86 show_on_init_(false), | 86 show_on_init_(false), |
87 should_reinitialize_language_keyboard_list_(false), | 87 should_reinitialize_language_keyboard_list_(false), |
88 weak_ptr_factory_(this) { | 88 weak_ptr_factory_(this) { |
89 DCHECK(core_oobe_actor_); | 89 DCHECK(core_oobe_actor_); |
90 SetupTimeouts(); | 90 SetupTimeouts(); |
91 | 91 |
92 input_method::InputMethodManager* manager = | 92 input_method::InputMethodManager* manager = |
93 input_method::InputMethodManager::Get(); | 93 input_method::InputMethodManager::Get(); |
94 manager->SetInputMethodLoginDefault(); | |
95 manager->GetComponentExtensionIMEManager()->AddObserver(this); | 94 manager->GetComponentExtensionIMEManager()->AddObserver(this); |
96 } | 95 } |
97 | 96 |
98 NetworkScreenHandler::~NetworkScreenHandler() { | 97 NetworkScreenHandler::~NetworkScreenHandler() { |
99 if (screen_) | 98 if (screen_) |
100 screen_->OnActorDestroyed(this); | 99 screen_->OnActorDestroyed(this); |
101 | 100 |
102 input_method::InputMethodManager::Get() | 101 input_method::InputMethodManager::Get() |
103 ->GetComponentExtensionIMEManager() | 102 ->GetComponentExtensionIMEManager() |
104 ->RemoveObserver(this); | 103 ->RemoveObserver(this); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 input_method::InputMethodManager::Get()->GetInputMethodUtil(); | 428 input_method::InputMethodManager::Get()->GetInputMethodUtil(); |
430 const std::string& ime_id = method.id(); | 429 const std::string& ime_id = method.id(); |
431 scoped_ptr<base::DictionaryValue> input_method(new base::DictionaryValue); | 430 scoped_ptr<base::DictionaryValue> input_method(new base::DictionaryValue); |
432 input_method->SetString("value", ime_id); | 431 input_method->SetString("value", ime_id); |
433 input_method->SetString("title", util->GetInputMethodLongName(method)); | 432 input_method->SetString("title", util->GetInputMethodLongName(method)); |
434 input_method->SetBoolean("selected", ime_id == current_input_method_id); | 433 input_method->SetBoolean("selected", ime_id == current_input_method_id); |
435 return input_method.release(); | 434 return input_method.release(); |
436 } | 435 } |
437 | 436 |
438 void NetworkScreenHandler::OnImeComponentExtensionInitialized() { | 437 void NetworkScreenHandler::OnImeComponentExtensionInitialized() { |
439 input_method::InputMethodManager::Get()->SetInputMethodLoginDefault(); | |
440 | |
441 // Refreshes the language and keyboard list once the component extension | 438 // Refreshes the language and keyboard list once the component extension |
442 // IMEs are initialized. | 439 // IMEs are initialized. |
443 if (page_is_ready()) | 440 if (page_is_ready()) |
444 ReloadLocalizedContent(); | 441 ReloadLocalizedContent(); |
445 else | 442 else |
446 should_reinitialize_language_keyboard_list_ = true; | 443 should_reinitialize_language_keyboard_list_ = true; |
447 } | 444 } |
448 | 445 |
449 void NetworkScreenHandler::ReloadLocalizedContent() { | 446 void NetworkScreenHandler::ReloadLocalizedContent() { |
450 base::DictionaryValue localized_strings; | 447 base::DictionaryValue localized_strings; |
(...skipping 16 matching lines...) Expand all Loading... |
467 manager->GetComponentExtensionIMEManager(); | 464 manager->GetComponentExtensionIMEManager(); |
468 if (!comp_manager->IsInitialized()) { | 465 if (!comp_manager->IsInitialized()) { |
469 input_method::InputMethodDescriptor fallback = | 466 input_method::InputMethodDescriptor fallback = |
470 util->GetFallbackInputMethodDescriptor(); | 467 util->GetFallbackInputMethodDescriptor(); |
471 input_methods_list->Append( | 468 input_methods_list->Append( |
472 CreateInputMethodsEntry(fallback, fallback.id())); | 469 CreateInputMethodsEntry(fallback, fallback.id())); |
473 return input_methods_list; | 470 return input_methods_list; |
474 } | 471 } |
475 } | 472 } |
476 | 473 |
| 474 const std::vector<std::string>& hardware_login_input_methods = |
| 475 util->GetHardwareLoginInputMethodIds(); |
| 476 manager->EnableLoginLayouts(g_browser_process->GetApplicationLocale(), |
| 477 hardware_login_input_methods); |
| 478 |
477 scoped_ptr<input_method::InputMethodDescriptors> input_methods( | 479 scoped_ptr<input_method::InputMethodDescriptors> input_methods( |
478 manager->GetActiveInputMethods()); | 480 manager->GetActiveInputMethods()); |
479 const std::string& current_input_method_id = | 481 const std::string& current_input_method_id = |
480 manager->GetCurrentInputMethod().id(); | 482 manager->GetCurrentInputMethod().id(); |
481 const std::vector<std::string>& hardware_login_input_methods = | |
482 util->GetHardwareLoginInputMethodIds(); | |
483 std::set<std::string> input_methods_added; | 483 std::set<std::string> input_methods_added; |
484 | 484 |
485 for (std::vector<std::string>::const_iterator i = | 485 for (std::vector<std::string>::const_iterator i = |
486 hardware_login_input_methods.begin(); | 486 hardware_login_input_methods.begin(); |
487 i != hardware_login_input_methods.end(); | 487 i != hardware_login_input_methods.end(); |
488 ++i) { | 488 ++i) { |
489 const input_method::InputMethodDescriptor* ime = | 489 const input_method::InputMethodDescriptor* ime = |
490 util->GetInputMethodDescriptorFromId(*i); | 490 util->GetInputMethodDescriptorFromId(*i); |
491 DCHECK(ime != NULL); | 491 DCHECK(ime != NULL); |
492 // Do not crash in case of misconfiguration. | 492 // Do not crash in case of misconfiguration. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 timezone_option->SetString("value", timezone_id); | 549 timezone_option->SetString("value", timezone_id); |
550 timezone_option->SetString("title", timezone_name); | 550 timezone_option->SetString("title", timezone_name); |
551 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); | 551 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); |
552 timezone_list->Append(timezone_option.release()); | 552 timezone_list->Append(timezone_option.release()); |
553 } | 553 } |
554 | 554 |
555 return timezone_list.release(); | 555 return timezone_list.release(); |
556 } | 556 } |
557 | 557 |
558 } // namespace chromeos | 558 } // namespace chromeos |
OLD | NEW |