Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 | 714 |
| 715 // Reset Caps Lock state when login screen is shown. | 715 // Reset Caps Lock state when login screen is shown. |
| 716 input_method::InputMethodManager::Get() | 716 input_method::InputMethodManager::Get() |
| 717 ->GetImeKeyboard() | 717 ->GetImeKeyboard() |
| 718 ->SetCapsLockEnabled(false); | 718 ->SetCapsLockEnabled(false); |
| 719 | 719 |
| 720 base::DictionaryValue params; | 720 base::DictionaryValue params; |
| 721 params.SetBoolean("disableAddUser", AllWhitelistedUsersPresent()); | 721 params.SetBoolean("disableAddUser", AllWhitelistedUsersPresent()); |
| 722 UpdateUIState(UI_STATE_ACCOUNT_PICKER, ¶ms); | 722 UpdateUIState(UI_STATE_ACCOUNT_PICKER, ¶ms); |
| 723 } | 723 } |
| 724 | |
| 725 // Enable pin for any users who can use it. | |
| 726 if (user_manager::UserManager::IsInitialized()) { | |
| 727 for (user_manager::User* user : | |
| 728 user_manager::UserManager::Get()->GetLoggedInUsers()) { | |
|
xiyuan
2017/04/03 21:21:43
nit: GetLoggedInUsers() -> GetUnlockUsers() ?
The
jdufault
2017/04/10 21:06:31
Done.
| |
| 729 UpdatePinKeyboardState(user->GetAccountId()); | |
| 730 } | |
| 731 } | |
| 724 } | 732 } |
| 725 | 733 |
| 726 void SigninScreenHandler::UpdateUIState(UIState ui_state, | 734 void SigninScreenHandler::UpdateUIState(UIState ui_state, |
| 727 base::DictionaryValue* params) { | 735 base::DictionaryValue* params) { |
| 728 switch (ui_state) { | 736 switch (ui_state) { |
| 729 case UI_STATE_GAIA_SIGNIN: | 737 case UI_STATE_GAIA_SIGNIN: |
| 730 ui_state_ = UI_STATE_GAIA_SIGNIN; | 738 ui_state_ = UI_STATE_GAIA_SIGNIN; |
| 731 ShowScreenWithData(OobeScreen::SCREEN_GAIA_SIGNIN, params); | 739 ShowScreenWithData(OobeScreen::SCREEN_GAIA_SIGNIN, params); |
| 732 break; | 740 break; |
| 733 case UI_STATE_ACCOUNT_PICKER: | 741 case UI_STATE_ACCOUNT_PICKER: |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 } | 1008 } |
| 1001 | 1009 |
| 1002 void SigninScreenHandler::ClearUserPodPassword() { | 1010 void SigninScreenHandler::ClearUserPodPassword() { |
| 1003 core_oobe_view_->ClearUserPodPassword(); | 1011 core_oobe_view_->ClearUserPodPassword(); |
| 1004 } | 1012 } |
| 1005 | 1013 |
| 1006 void SigninScreenHandler::RefocusCurrentPod() { | 1014 void SigninScreenHandler::RefocusCurrentPod() { |
| 1007 core_oobe_view_->RefocusCurrentPod(); | 1015 core_oobe_view_->RefocusCurrentPod(); |
| 1008 } | 1016 } |
| 1009 | 1017 |
| 1010 void SigninScreenHandler::HidePinKeyboardIfNeeded(const AccountId& account_id) { | 1018 void SigninScreenHandler::UpdatePinKeyboardState(const AccountId& account_id) { |
| 1011 chromeos::quick_unlock::QuickUnlockStorage* quick_unlock_storage = | 1019 chromeos::quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 1012 chromeos::quick_unlock::QuickUnlockFactory::GetForAccountId(account_id); | 1020 chromeos::quick_unlock::QuickUnlockFactory::GetForAccountId(account_id); |
| 1013 if (quick_unlock_storage && | 1021 if (!quick_unlock_storage) |
| 1014 !quick_unlock_storage->IsPinAuthenticationAvailable()) | 1022 return; |
| 1015 CallJS("login.AccountPickerScreen.disablePinKeyboardForUser", account_id); | 1023 |
| 1024 bool is_enabled = quick_unlock_storage->IsPinAuthenticationAvailable(); | |
| 1025 CallJS("login.AccountPickerScreen.setPinEnabledForUser", account_id, | |
| 1026 is_enabled); | |
| 1016 } | 1027 } |
| 1017 | 1028 |
| 1018 void SigninScreenHandler::OnUserRemoved(const AccountId& account_id, | 1029 void SigninScreenHandler::OnUserRemoved(const AccountId& account_id, |
| 1019 bool last_user_removed) { | 1030 bool last_user_removed) { |
| 1020 CallJS("login.AccountPickerScreen.removeUser", account_id); | 1031 CallJS("login.AccountPickerScreen.removeUser", account_id); |
| 1021 if (last_user_removed) | 1032 if (last_user_removed) |
| 1022 OnShowAddUser(); | 1033 OnShowAddUser(); |
| 1023 } | 1034 } |
| 1024 | 1035 |
| 1025 void SigninScreenHandler::OnUserImageChanged(const user_manager::User& user) { | 1036 void SigninScreenHandler::OnUserImageChanged(const user_manager::User& user) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1132 break; | 1143 break; |
| 1133 } | 1144 } |
| 1134 default: | 1145 default: |
| 1135 NOTREACHED() << "Unexpected notification " << type; | 1146 NOTREACHED() << "Unexpected notification " << type; |
| 1136 } | 1147 } |
| 1137 } | 1148 } |
| 1138 | 1149 |
| 1139 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) { | 1150 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) { |
| 1140 for (user_manager::User* user : | 1151 for (user_manager::User* user : |
| 1141 user_manager::UserManager::Get()->GetUnlockUsers()) { | 1152 user_manager::UserManager::Get()->GetUnlockUsers()) { |
| 1142 HidePinKeyboardIfNeeded(user->GetAccountId()); | 1153 UpdatePinKeyboardState(user->GetAccountId()); |
| 1143 } | 1154 } |
| 1144 } | 1155 } |
| 1145 | 1156 |
| 1146 void SigninScreenHandler::OnTouchViewToggled(bool enabled) { | 1157 void SigninScreenHandler::OnTouchViewToggled(bool enabled) { |
| 1147 touch_view_enabled_ = enabled; | 1158 touch_view_enabled_ = enabled; |
| 1148 CallJSOrDefer("login.AccountPickerScreen.setTouchViewState", enabled); | 1159 CallJSOrDefer("login.AccountPickerScreen.setTouchViewState", enabled); |
| 1149 } | 1160 } |
| 1150 | 1161 |
| 1151 bool SigninScreenHandler::ShouldLoadGaia() const { | 1162 bool SigninScreenHandler::ShouldLoadGaia() const { |
| 1152 // Fetching of the extension is not started before account picker page is | 1163 // Fetching of the extension is not started before account picker page is |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1175 quick_unlock_storage->IsPinAuthenticationAvailable() || | 1186 quick_unlock_storage->IsPinAuthenticationAvailable() || |
| 1176 !authenticated_by_pin); | 1187 !authenticated_by_pin); |
| 1177 | 1188 |
| 1178 UserContext user_context(account_id); | 1189 UserContext user_context(account_id); |
| 1179 user_context.SetKey(Key(password)); | 1190 user_context.SetKey(Key(password)); |
| 1180 user_context.SetIsUsingPin(authenticated_by_pin); | 1191 user_context.SetIsUsingPin(authenticated_by_pin); |
| 1181 if (account_id.GetAccountType() == AccountType::ACTIVE_DIRECTORY) | 1192 if (account_id.GetAccountType() == AccountType::ACTIVE_DIRECTORY) |
| 1182 user_context.SetUserType(user_manager::USER_TYPE_ACTIVE_DIRECTORY); | 1193 user_context.SetUserType(user_manager::USER_TYPE_ACTIVE_DIRECTORY); |
| 1183 delegate_->Login(user_context, SigninSpecifics()); | 1194 delegate_->Login(user_context, SigninSpecifics()); |
| 1184 | 1195 |
| 1185 HidePinKeyboardIfNeeded(account_id); | 1196 UpdatePinKeyboardState(account_id); |
| 1186 } | 1197 } |
| 1187 | 1198 |
| 1188 void SigninScreenHandler::HandleLaunchIncognito() { | 1199 void SigninScreenHandler::HandleLaunchIncognito() { |
| 1189 UserContext context(user_manager::USER_TYPE_GUEST, EmptyAccountId()); | 1200 UserContext context(user_manager::USER_TYPE_GUEST, EmptyAccountId()); |
| 1190 if (delegate_) | 1201 if (delegate_) |
| 1191 delegate_->Login(context, SigninSpecifics()); | 1202 delegate_->Login(context, SigninSpecifics()); |
| 1192 } | 1203 } |
| 1193 | 1204 |
| 1194 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { | 1205 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { |
| 1195 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { | 1206 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 rate.initial_delay_in_ms = auto_repeat_delay; | 1655 rate.initial_delay_in_ms = auto_repeat_delay; |
| 1645 rate.repeat_interval_in_ms = auto_repeat_interval; | 1656 rate.repeat_interval_in_ms = auto_repeat_interval; |
| 1646 input_method::InputMethodManager::Get() | 1657 input_method::InputMethodManager::Get() |
| 1647 ->GetImeKeyboard() | 1658 ->GetImeKeyboard() |
| 1648 ->SetAutoRepeatEnabled(true); | 1659 ->SetAutoRepeatEnabled(true); |
| 1649 input_method::InputMethodManager::Get()->GetImeKeyboard()->SetAutoRepeatRate( | 1660 input_method::InputMethodManager::Get()->GetImeKeyboard()->SetAutoRepeatRate( |
| 1650 rate); | 1661 rate); |
| 1651 } | 1662 } |
| 1652 | 1663 |
| 1653 } // namespace chromeos | 1664 } // namespace chromeos |
| OLD | NEW |