OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 } | 1011 } |
1012 } | 1012 } |
1013 | 1013 |
1014 void SigninScreenHandler::OnDnsCleared() { | 1014 void SigninScreenHandler::OnDnsCleared() { |
1015 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1015 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1016 dns_clear_task_running_ = false; | 1016 dns_clear_task_running_ = false; |
1017 dns_cleared_ = true; | 1017 dns_cleared_ = true; |
1018 ShowSigninScreenIfReady(); | 1018 ShowSigninScreenIfReady(); |
1019 } | 1019 } |
1020 | 1020 |
1021 void SigninScreenHandler::SetUserInputMethodHWDefault() { | |
1022 chromeos::input_method::InputMethodManager* manager = | |
1023 chromeos::input_method::InputMethodManager::Get(); | |
1024 manager->ChangeInputMethod( | |
1025 manager->GetInputMethodUtil()->GetHardwareInputMethodId()); | |
1026 } | |
1027 | |
1028 // Update keyboard layout to least recently used by the user. | 1021 // Update keyboard layout to least recently used by the user. |
1029 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { | 1022 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { |
1030 chromeos::input_method::InputMethodManager* const manager = | 1023 chromeos::input_method::InputMethodManager* const manager = |
1031 chromeos::input_method::InputMethodManager::Get(); | 1024 chromeos::input_method::InputMethodManager::Get(); |
1032 | 1025 |
1033 const chromeos::input_method::InputMethodUtil& ime_util = | |
1034 *manager->GetInputMethodUtil(); | |
1035 | |
1036 const bool succeed = SetUserInputMethodImpl(username, manager); | 1026 const bool succeed = SetUserInputMethodImpl(username, manager); |
1037 | 1027 |
1038 // This is also a case when LRU layout is set only for a few local users, | 1028 // This is also a case when LRU layout is set only for a few local users, |
1039 // thus others need to be switched to default locale. | 1029 // thus others need to be switched to default locale. |
1040 // Otherwise they will end up using another user's locale to log in. | 1030 // Otherwise they will end up using another user's locale to log in. |
1041 if (!succeed) { | 1031 if (!succeed) { |
1042 DLOG(INFO) << "SetUserInputMethod('" << username | 1032 DLOG(INFO) << "SetUserInputMethod('" << username |
1043 << "'): failed to set user layout. Switching to default '" | 1033 << "'): failed to set user layout. Switching to default."; |
1044 << ime_util.GetHardwareInputMethodId() << "'"; | |
1045 | 1034 |
1046 SetUserInputMethodHWDefault(); | 1035 manager->SetInputMethodDefault(); |
1047 } | 1036 } |
1048 } | 1037 } |
1049 | 1038 |
1050 void SigninScreenHandler::ShowSigninScreenIfReady() { | 1039 void SigninScreenHandler::ShowSigninScreenIfReady() { |
1051 if (!dns_cleared_ || !cookies_cleared_ || !delegate_) | 1040 if (!dns_cleared_ || !cookies_cleared_ || !delegate_) |
1052 return; | 1041 return; |
1053 | 1042 |
1054 std::string active_network_path = network_state_informer_->network_path(); | 1043 std::string active_network_path = network_state_informer_->network_path(); |
1055 if (gaia_silent_load_ && | 1044 if (gaia_silent_load_ && |
1056 (network_state_informer_->state() != NetworkStateInformer::ONLINE || | 1045 (network_state_informer_->state() != NetworkStateInformer::ONLINE || |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 rvh->ExecuteJavascriptInWebFrame( | 1747 rvh->ExecuteJavascriptInWebFrame( |
1759 ASCIIToUTF16("//iframe[@id='signin-frame']\n//iframe"), | 1748 ASCIIToUTF16("//iframe[@id='signin-frame']\n//iframe"), |
1760 ASCIIToUTF16(code)); | 1749 ASCIIToUTF16(code)); |
1761 | 1750 |
1762 // Test properties are cleared in HandleCompleteLogin because the form | 1751 // Test properties are cleared in HandleCompleteLogin because the form |
1763 // submission might fail and login will not be attempted after reloading | 1752 // submission might fail and login will not be attempted after reloading |
1764 // if they are cleared here. | 1753 // if they are cleared here. |
1765 } | 1754 } |
1766 | 1755 |
1767 } // namespace chromeos | 1756 } // namespace chromeos |
OLD | NEW |