Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Returns network name by service path. 170 // Returns network name by service path.
171 std::string GetNetworkName(const std::string& service_path) { 171 std::string GetNetworkName(const std::string& service_path) {
172 const NetworkState* network = NetworkHandler::Get()->network_state_handler()-> 172 const NetworkState* network = NetworkHandler::Get()->network_state_handler()->
173 GetNetworkState(service_path); 173 GetNetworkState(service_path);
174 if (!network) 174 if (!network)
175 return std::string(); 175 return std::string();
176 return network->name(); 176 return network->name();
177 } 177 }
178 178
179 static bool SetUserInputMethodImpl( 179 static bool SetUserInputMethodImpl(
180 const std::string& username, 180 const user_manager::UserID& user_id,
181 const std::string& user_input_method, 181 const std::string& user_input_method,
182 input_method::InputMethodManager::State* ime_state) { 182 input_method::InputMethodManager::State* ime_state) {
183 if (!chromeos::input_method::InputMethodManager::Get()->IsLoginKeyboard( 183 if (!chromeos::input_method::InputMethodManager::Get()->IsLoginKeyboard(
184 user_input_method)) { 184 user_input_method)) {
185 LOG(WARNING) << "SetUserInputMethod('" << username 185 LOG(WARNING) << "SetUserInputMethod('" << user_id.GetUserEmail()
186 << "'): stored user LRU input method '" << user_input_method 186 << "'): stored user LRU input method '" << user_input_method
187 << "' is no longer Full Latin Keyboard Language" 187 << "' is no longer Full Latin Keyboard Language"
188 << " (entry dropped). Use hardware default instead."; 188 << " (entry dropped). Use hardware default instead.";
189 189
190 PrefService* const local_state = g_browser_process->local_state(); 190 PrefService* const local_state = g_browser_process->local_state();
191 DictionaryPrefUpdate updater(local_state, prefs::kUsersLRUInputMethod); 191 DictionaryPrefUpdate updater(local_state, prefs::kUsersLRUInputMethod);
192 192
193 base::DictionaryValue* const users_lru_input_methods = updater.Get(); 193 base::DictionaryValue* const users_lru_input_methods = updater.Get();
194 if (users_lru_input_methods != NULL) { 194 if (users_lru_input_methods != NULL) {
195 users_lru_input_methods->SetStringWithoutPathExpansion(username, ""); 195 users_lru_input_methods->SetStringWithoutPathExpansion(user_id.GetUserEmai l(), "");
196 } 196 }
197 return false; 197 return false;
198 } 198 }
199 199
200 if (!Contains(ime_state->GetActiveInputMethodIds(), user_input_method)) { 200 if (!Contains(ime_state->GetActiveInputMethodIds(), user_input_method)) {
201 if (!ime_state->EnableInputMethod(user_input_method)) { 201 if (!ime_state->EnableInputMethod(user_input_method)) {
202 DLOG(ERROR) << "SigninScreenHandler::SetUserInputMethod('" << username 202 DLOG(ERROR) << "SigninScreenHandler::SetUserInputMethod('" << user_id.GetU serEmail()
203 << "'): user input method '" << user_input_method 203 << "'): user input method '" << user_input_method
204 << "' is not enabled and enabling failed (ignored!)."; 204 << "' is not enabled and enabling failed (ignored!).";
205 } 205 }
206 } 206 }
207 ime_state->ChangeInputMethod(user_input_method, false /* show_message */); 207 ime_state->ChangeInputMethod(user_input_method, false /* show_message */);
208 208
209 return true; 209 return true;
210 } 210 }
211 211
212 } // namespace 212 } // namespace
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 keyboard->RemoveObserver(this); 290 keyboard->RemoveObserver(this);
291 weak_factory_.InvalidateWeakPtrs(); 291 weak_factory_.InvalidateWeakPtrs();
292 if (delegate_) 292 if (delegate_)
293 delegate_->SetWebUIHandler(NULL); 293 delegate_->SetWebUIHandler(NULL);
294 network_state_informer_->RemoveObserver(this); 294 network_state_informer_->RemoveObserver(this);
295 if (max_mode_delegate_) { 295 if (max_mode_delegate_) {
296 max_mode_delegate_->RemoveObserver(this); 296 max_mode_delegate_->RemoveObserver(this);
297 max_mode_delegate_.reset(NULL); 297 max_mode_delegate_.reset(NULL);
298 } 298 }
299 GetScreenlockBridgeInstance()->SetLockHandler(NULL); 299 GetScreenlockBridgeInstance()->SetLockHandler(NULL);
300 GetScreenlockBridgeInstance()->SetFocusedUser(""); 300 GetScreenlockBridgeInstance()->SetFocusedUser(user_manager::UserID(std::string (), std::string()));
301 } 301 }
302 302
303 // static 303 // static
304 std::string SigninScreenHandler::GetUserLRUInputMethod( 304 std::string SigninScreenHandler::GetUserLRUInputMethod(
305 const std::string& username) { 305 const user_manager::UserID& user_id) {
306 PrefService* const local_state = g_browser_process->local_state(); 306 PrefService* const local_state = g_browser_process->local_state();
307 const base::DictionaryValue* users_lru_input_methods = 307 const base::DictionaryValue* users_lru_input_methods =
308 local_state->GetDictionary(prefs::kUsersLRUInputMethod); 308 local_state->GetDictionary(prefs::kUsersLRUInputMethod);
309 309
310 if (!users_lru_input_methods) { 310 if (!users_lru_input_methods) {
311 DLOG(WARNING) << "GetUserLRUInputMethod('" << username 311 DLOG(WARNING) << "GetUserLRUInputMethod('" << user_id.GetUserEmail()
312 << "'): no kUsersLRUInputMethod"; 312 << "'): no kUsersLRUInputMethod";
313 return std::string(); 313 return std::string();
314 } 314 }
315 315
316 std::string input_method; 316 std::string input_method;
317 317
318 if (!users_lru_input_methods->GetStringWithoutPathExpansion(username, 318 if (!users_lru_input_methods->GetStringWithoutPathExpansion(user_id.GetUserEma il(),
319 &input_method)) { 319 &input_method)) {
320 DVLOG(0) << "GetUserLRUInputMethod('" << username 320 DVLOG(0) << "GetUserLRUInputMethod('" << user_id.GetUserEmail()
321 << "'): no input method for this user"; 321 << "'): no input method for this user";
322 return std::string(); 322 return std::string();
323 } 323 }
324 324
325 return input_method; 325 return input_method;
326 } 326 }
327 327
328 // static 328 // static
329 // Update keyboard layout to least recently used by the user. 329 // Update keyboard layout to least recently used by the user.
330 void SigninScreenHandler::SetUserInputMethod( 330 void SigninScreenHandler::SetUserInputMethod(
331 const std::string& username, 331 const user_manager::UserID& user_id,
332 input_method::InputMethodManager::State* ime_state) { 332 input_method::InputMethodManager::State* ime_state) {
333 bool succeed = false; 333 bool succeed = false;
334 334
335 const std::string input_method = GetUserLRUInputMethod(username); 335 const std::string input_method = GetUserLRUInputMethod(user_id);
336 336
337 if (!input_method.empty()) 337 if (!input_method.empty())
338 succeed = SetUserInputMethodImpl(username, input_method, ime_state); 338 succeed = SetUserInputMethodImpl(user_id, input_method, ime_state);
339 339
340 // This is also a case when LRU layout is set only for a few local users, 340 // This is also a case when LRU layout is set only for a few local users,
341 // thus others need to be switched to default locale. 341 // thus others need to be switched to default locale.
342 // Otherwise they will end up using another user's locale to log in. 342 // Otherwise they will end up using another user's locale to log in.
343 if (!succeed) { 343 if (!succeed) {
344 DVLOG(0) << "SetUserInputMethod('" << username 344 DVLOG(0) << "SetUserInputMethod('" << user_id.GetUserEmail()
345 << "'): failed to set user layout. Switching to default."; 345 << "'): failed to set user layout. Switching to default.";
346 346
347 ime_state->SetInputMethodLoginDefault(); 347 ime_state->SetInputMethodLoginDefault();
348 } 348 }
349 } 349 }
350 350
351 void SigninScreenHandler::DeclareLocalizedValues( 351 void SigninScreenHandler::DeclareLocalizedValues(
352 ::login::LocalizedValuesBuilder* builder) { 352 ::login::LocalizedValuesBuilder* builder) {
353 builder->Add("passwordHint", IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT); 353 builder->Add("passwordHint", IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT);
354 builder->Add("signingIn", IDS_LOGIN_POD_SIGNING_IN); 354 builder->Add("signingIn", IDS_LOGIN_POD_SIGNING_IN);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 880
881 void SigninScreenHandler::ClearUserPodPassword() { 881 void SigninScreenHandler::ClearUserPodPassword() {
882 core_oobe_actor_->ClearUserPodPassword(); 882 core_oobe_actor_->ClearUserPodPassword();
883 } 883 }
884 884
885 void SigninScreenHandler::RefocusCurrentPod() { 885 void SigninScreenHandler::RefocusCurrentPod() {
886 core_oobe_actor_->RefocusCurrentPod(); 886 core_oobe_actor_->RefocusCurrentPod();
887 } 887 }
888 888
889 void SigninScreenHandler::OnUserRemoved(const std::string& username) { 889 void SigninScreenHandler::OnUserRemoved(const user_manager::UserID& user_id) {
890 CallJS("login.AccountPickerScreen.removeUser", username); 890 CallJS("login.AccountPickerScreen.removeUser", user_id.GetUserEmail());
891 if (delegate_->GetUsers().empty()) 891 if (delegate_->GetUsers().empty())
892 OnShowAddUser(); 892 OnShowAddUser();
893 } 893 }
894 894
895 void SigninScreenHandler::OnUserImageChanged(const user_manager::User& user) { 895 void SigninScreenHandler::OnUserImageChanged(const user_manager::User& user) {
896 if (page_is_ready()) 896 if (page_is_ready())
897 CallJS("login.AccountPickerScreen.updateUserImage", user.email()); 897 CallJS("login.AccountPickerScreen.updateUserImage", user.GetUserID().GetUser Email());
898 } 898 }
899 899
900 void SigninScreenHandler::OnPreferencesChanged() { 900 void SigninScreenHandler::OnPreferencesChanged() {
901 // Make sure that one of the login UI is fully functional now, otherwise 901 // Make sure that one of the login UI is fully functional now, otherwise
902 // preferences update would be picked up next time it will be shown. 902 // preferences update would be picked up next time it will be shown.
903 if (!webui_visible_) { 903 if (!webui_visible_) {
904 LOG(WARNING) << "Login UI is not active - postponed prefs change."; 904 LOG(WARNING) << "Login UI is not active - postponed prefs change.";
905 preferences_changed_delayed_ = true; 905 preferences_changed_delayed_ = true;
906 return; 906 return;
907 } 907 }
(...skipping 24 matching lines...) Expand all
932 switch (error_id) { 932 switch (error_id) {
933 case LoginDisplay::TPM_ERROR: 933 case LoginDisplay::TPM_ERROR:
934 core_oobe_actor_->ShowTpmError(); 934 core_oobe_actor_->ShowTpmError();
935 break; 935 break;
936 default: 936 default:
937 NOTREACHED() << "Unknown sign in error"; 937 NOTREACHED() << "Unknown sign in error";
938 break; 938 break;
939 } 939 }
940 } 940 }
941 941
942 void SigninScreenHandler::ShowSigninUI(const std::string& email) { 942 void SigninScreenHandler::ShowSigninUI(const user_manager::UserID& user_id) {
943 core_oobe_actor_->ShowSignInUI(email); 943 core_oobe_actor_->ShowSignInUI(user_id);
944 } 944 }
945 945
946 void SigninScreenHandler::ShowGaiaPasswordChanged(const std::string& username) { 946 void SigninScreenHandler::ShowGaiaPasswordChanged(const user_manager::UserID& us er_id) {
947 gaia_screen_handler_->PasswordChangedFor(username); 947 gaia_screen_handler_->PasswordChangedFor(user_id);
948 gaia_screen_handler_->PopulateEmail(username); 948 gaia_screen_handler_->PopulateEmail(user_id.GetUserEmail());
949 core_oobe_actor_->ShowSignInUI(username); 949 core_oobe_actor_->ShowSignInUI(user_id);
950 CallJS("login.setAuthType", username, 950 CallJS("login.setAuthType", user_id.GetUserEmail(),
951 static_cast<int>(UserSelectionScreen::ONLINE_SIGN_IN), 951 static_cast<int>(UserSelectionScreen::ONLINE_SIGN_IN),
952 base::StringValue("")); 952 base::StringValue(""));
953 } 953 }
954 954
955 void SigninScreenHandler::ShowPasswordChangedDialog(bool show_password_error, 955 void SigninScreenHandler::ShowPasswordChangedDialog(bool show_password_error,
956 const std::string& email) { 956 const user_manager::UserID& user_id) {
957 core_oobe_actor_->ShowPasswordChangedScreen(show_password_error, email); 957 core_oobe_actor_->ShowPasswordChangedScreen(show_password_error, user_id);
958 } 958 }
959 959
960 void SigninScreenHandler::ShowSigninScreenForCreds( 960 void SigninScreenHandler::ShowSigninScreenForCreds(
961 const std::string& username, 961 const user_manager::UserID& user_id,
962 const std::string& password) { 962 const std::string& password) {
963 DCHECK(gaia_screen_handler_); 963 DCHECK(gaia_screen_handler_);
964 gaia_screen_handler_->ShowSigninScreenForCreds(username, password); 964 gaia_screen_handler_->ShowSigninScreenForCreds(user_id, password);
965 } 965 }
966 966
967 void SigninScreenHandler::ShowWhitelistCheckFailedError() { 967 void SigninScreenHandler::ShowWhitelistCheckFailedError() {
968 DCHECK(gaia_screen_handler_); 968 DCHECK(gaia_screen_handler_);
969 gaia_screen_handler_->ShowWhitelistCheckFailedError(); 969 gaia_screen_handler_->ShowWhitelistCheckFailedError();
970 } 970 }
971 971
972 void SigninScreenHandler::Observe(int type, 972 void SigninScreenHandler::Observe(int type,
973 const content::NotificationSource& source, 973 const content::NotificationSource& source,
974 const content::NotificationDetails& details) { 974 const content::NotificationDetails& details) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1022
1023 void SigninScreenHandler::UpdateAddButtonStatus() { 1023 void SigninScreenHandler::UpdateAddButtonStatus() {
1024 CallJS("cr.ui.login.DisplayManager.updateAddUserButtonStatus", 1024 CallJS("cr.ui.login.DisplayManager.updateAddUserButtonStatus",
1025 AllWhitelistedUsersPresent()); 1025 AllWhitelistedUsersPresent());
1026 } 1026 }
1027 1027
1028 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, 1028 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username,
1029 const std::string& password) { 1029 const std::string& password) {
1030 if (!delegate_) 1030 if (!delegate_)
1031 return; 1031 return;
1032 UserContext user_context(gaia::SanitizeEmail(username)); 1032 UserContext user_context(user_manager::UserID::FromUserEmail(gaia::SanitizeEma il(username)));
1033 user_context.SetKey(Key(password)); 1033 user_context.SetKey(Key(password));
1034 delegate_->Login(user_context, SigninSpecifics()); 1034 delegate_->Login(user_context, SigninSpecifics());
1035 } 1035 }
1036 1036
1037 void SigninScreenHandler::HandleLaunchIncognito() { 1037 void SigninScreenHandler::HandleLaunchIncognito() {
1038 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); 1038 UserContext context(user_manager::USER_TYPE_GUEST, user_manager::UserID(std::s tring(), std::string()));
1039 if (delegate_) 1039 if (delegate_)
1040 delegate_->Login(context, SigninSpecifics()); 1040 delegate_->Login(context, SigninSpecifics());
1041 } 1041 }
1042 1042
1043 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { 1043 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() {
1044 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { 1044 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) {
1045 LOG(ERROR) << "Managed users not allowed."; 1045 LOG(ERROR) << "Managed users not allowed.";
1046 return; 1046 return;
1047 } 1047 }
1048 LoginDisplayHostImpl::default_host()-> 1048 LoginDisplayHostImpl::default_host()->
1049 StartWizard(WizardController::kSupervisedUserCreationScreenName); 1049 StartWizard(WizardController::kSupervisedUserCreationScreenName);
1050 } 1050 }
1051 1051
1052 void SigninScreenHandler::HandleLaunchPublicSession( 1052 void SigninScreenHandler::HandleLaunchPublicSession(
1053 const std::string& user_id, 1053 const std::string& user_id_str,
1054 const std::string& locale, 1054 const std::string& locale,
1055 const std::string& input_method) { 1055 const std::string& input_method) {
1056 if (!delegate_) 1056 if (!delegate_)
1057 return; 1057 return;
1058 1058
1059 const user_manager::UserID user_id(user_manager::UserID::FromUserEmail(user_id _str));
1060
1059 UserContext context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_id); 1061 UserContext context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_id);
1060 context.SetPublicSessionLocale(locale), 1062 context.SetPublicSessionLocale(locale),
1061 context.SetPublicSessionInputMethod(input_method); 1063 context.SetPublicSessionInputMethod(input_method);
1062 delegate_->Login(context, SigninSpecifics()); 1064 delegate_->Login(context, SigninSpecifics());
1063 } 1065 }
1064 1066
1065 void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) { 1067 void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) {
1066 if (!delegate_ || delegate_->IsShowUsers()) { 1068 if (!delegate_ || delegate_->IsShowUsers()) {
1067 NOTREACHED(); 1069 NOTREACHED();
1068 return; 1070 return;
1069 } 1071 }
1070 std::string email; 1072 std::string email;
1071 args->GetString(0, &email); 1073 args->GetString(0, &email);
1072 1074
1073 gaia_screen_handler_->PopulateEmail(email); 1075 gaia_screen_handler_->PopulateEmail(email);
1074 // Load auth extension. Parameters are: force reload, do not load extension in 1076 // Load auth extension. Parameters are: force reload, do not load extension in
1075 // background, use offline version. 1077 // background, use offline version.
1076 gaia_screen_handler_->LoadAuthExtension(true, false, true); 1078 gaia_screen_handler_->LoadAuthExtension(true, false, true);
1077 UpdateUIState(UI_STATE_GAIA_SIGNIN, NULL); 1079 UpdateUIState(UI_STATE_GAIA_SIGNIN, NULL);
1078 } 1080 }
1079 1081
1080 void SigninScreenHandler::HandleShutdownSystem() { 1082 void SigninScreenHandler::HandleShutdownSystem() {
1081 ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown(); 1083 ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown();
1082 } 1084 }
1083 1085
1084 void SigninScreenHandler::HandleLoadWallpaper(const std::string& email) { 1086 void SigninScreenHandler::HandleLoadWallpaper(const std::string& email) {
1085 if (delegate_) 1087 if (delegate_)
1086 delegate_->LoadWallpaper(email); 1088 delegate_->LoadWallpaper(user_manager::UserID::FromUserEmail(email));
1087 } 1089 }
1088 1090
1089 void SigninScreenHandler::HandleRebootSystem() { 1091 void SigninScreenHandler::HandleRebootSystem() {
1090 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); 1092 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
1091 } 1093 }
1092 1094
1093 void SigninScreenHandler::HandleRemoveUser(const std::string& email) { 1095 void SigninScreenHandler::HandleRemoveUser(const std::string& email) {
1094 if (!delegate_) 1096 if (!delegate_)
1095 return; 1097 return;
1096 delegate_->RemoveUser(email); 1098 delegate_->RemoveUser(user_manager::UserID::FromUserEmail(email));
1097 UpdateAddButtonStatus(); 1099 UpdateAddButtonStatus();
1098 } 1100 }
1099 1101
1100 void SigninScreenHandler::HandleShowAddUser(const base::ListValue* args) { 1102 void SigninScreenHandler::HandleShowAddUser(const base::ListValue* args) {
1101 TRACE_EVENT_ASYNC_STEP_INTO0("ui", 1103 TRACE_EVENT_ASYNC_STEP_INTO0("ui",
1102 "ShowLoginWebUI", 1104 "ShowLoginWebUI",
1103 LoginDisplayHostImpl::kShowLoginWebUIid, 1105 LoginDisplayHostImpl::kShowLoginWebUIid,
1104 "ShowAddUser"); 1106 "ShowAddUser");
1105 std::string email; 1107 std::string email;
1106 // |args| can be null if it's OOBE. 1108 // |args| can be null if it's OOBE.
1107 if (args) 1109 if (args)
1108 args->GetString(0, &email); 1110 args->GetString(0, &email);
1109 gaia_screen_handler_->PopulateEmail(email); 1111 gaia_screen_handler_->PopulateEmail(email);
1110 if (!email.empty()) 1112 if (!email.empty())
1111 SendReauthReason(email); 1113 SendReauthReason(user_manager::UserID::FromUserEmail(email));
1112 OnShowAddUser(); 1114 OnShowAddUser();
1113 } 1115 }
1114 1116
1115 void SigninScreenHandler::HandleToggleEnrollmentScreen() { 1117 void SigninScreenHandler::HandleToggleEnrollmentScreen() {
1116 if (delegate_) 1118 if (delegate_)
1117 delegate_->ShowEnterpriseEnrollmentScreen(); 1119 delegate_->ShowEnterpriseEnrollmentScreen();
1118 } 1120 }
1119 1121
1120 void SigninScreenHandler::HandleToggleEnableDebuggingScreen() { 1122 void SigninScreenHandler::HandleToggleEnableDebuggingScreen() {
1121 if (delegate_) 1123 if (delegate_)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 content::NotificationService::NoDetails()); 1209 content::NotificationService::NoDetails());
1208 TRACE_EVENT_ASYNC_END0( 1210 TRACE_EVENT_ASYNC_END0(
1209 "ui", "ShowLoginWebUI", LoginDisplayHostImpl::kShowLoginWebUIid); 1211 "ui", "ShowLoginWebUI", LoginDisplayHostImpl::kShowLoginWebUIid);
1210 } 1212 }
1211 webui_visible_ = true; 1213 webui_visible_ = true;
1212 if (preferences_changed_delayed_) 1214 if (preferences_changed_delayed_)
1213 OnPreferencesChanged(); 1215 OnPreferencesChanged();
1214 } 1216 }
1215 1217
1216 void SigninScreenHandler::HandleCancelPasswordChangedFlow( 1218 void SigninScreenHandler::HandleCancelPasswordChangedFlow(
1217 const std::string& user_id) { 1219 const std::string& user_id_str) {
1218 if (!user_id.empty()) 1220 if (!user_id_str.empty())
1219 RecordReauthReason(user_id, ReauthReason::PASSWORD_UPDATE_SKIPPED); 1221 RecordReauthReason(user_manager::UserID::FromUserEmail(user_id_str), ReauthR eason::PASSWORD_UPDATE_SKIPPED);
1220 gaia_screen_handler_->StartClearingCookies( 1222 gaia_screen_handler_->StartClearingCookies(
1221 base::Bind(&SigninScreenHandler::CancelPasswordChangedFlowInternal, 1223 base::Bind(&SigninScreenHandler::CancelPasswordChangedFlowInternal,
1222 weak_factory_.GetWeakPtr())); 1224 weak_factory_.GetWeakPtr()));
1223 } 1225 }
1224 1226
1225 void SigninScreenHandler::HandleCancelUserAdding() { 1227 void SigninScreenHandler::HandleCancelUserAdding() {
1226 if (delegate_) 1228 if (delegate_)
1227 delegate_->CancelUserAdding(); 1229 delegate_->CancelUserAdding();
1228 } 1230 }
1229 1231
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 } 1273 }
1272 1274
1273 void SigninScreenHandler::HandleShowLoadingTimeoutError() { 1275 void SigninScreenHandler::HandleShowLoadingTimeoutError() {
1274 UpdateState(NetworkError::ERROR_REASON_LOADING_TIMEOUT); 1276 UpdateState(NetworkError::ERROR_REASON_LOADING_TIMEOUT);
1275 } 1277 }
1276 1278
1277 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { 1279 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) {
1278 offline_login_active_ = offline_login_active; 1280 offline_login_active_ = offline_login_active;
1279 } 1281 }
1280 1282
1281 void SigninScreenHandler::HandleFocusPod(const std::string& user_id) { 1283 void SigninScreenHandler::HandleFocusPod(const std::string& user_id_str) {
1284 const user_manager::UserID user_id(user_manager::UserID::FromUserEmail(user_id _str));
1282 SetUserInputMethod(user_id, ime_state_.get()); 1285 SetUserInputMethod(user_id, ime_state_.get());
1283 WallpaperManager::Get()->SetUserWallpaperDelayed(user_id); 1286 WallpaperManager::Get()->SetUserWallpaperDelayed(user_id);
1284 GetScreenlockBridgeInstance()->SetFocusedUser(user_id); 1287 GetScreenlockBridgeInstance()->SetFocusedUser(user_id);
1285 if (delegate_) 1288 if (delegate_)
1286 delegate_->CheckUserStatus(user_id); 1289 delegate_->CheckUserStatus(user_id);
1287 if (!test_focus_pod_callback_.is_null()) 1290 if (!test_focus_pod_callback_.is_null())
1288 test_focus_pod_callback_.Run(); 1291 test_focus_pod_callback_.Run();
1289 } 1292 }
1290 1293
1291 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( 1294 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts(
1292 const std::string& user_id, 1295 const std::string& user_id_str,
1293 const std::string& locale) { 1296 const std::string& locale) {
1294 GetKeyboardLayoutsForLocale( 1297 GetKeyboardLayoutsForLocale(
1295 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, 1298 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts,
1296 weak_factory_.GetWeakPtr(), 1299 weak_factory_.GetWeakPtr(),
1297 user_id, 1300 user_manager::UserID::FromUserEmail(user_id_str),
1298 locale), 1301 locale),
1299 locale); 1302 locale);
1300 } 1303 }
1301 1304
1302 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( 1305 void SigninScreenHandler::SendPublicSessionKeyboardLayouts(
1303 const std::string& user_id, 1306 const user_manager::UserID& user_id,
1304 const std::string& locale, 1307 const std::string& locale,
1305 scoped_ptr<base::ListValue> keyboard_layouts) { 1308 scoped_ptr<base::ListValue> keyboard_layouts) {
1306 CallJS("login.AccountPickerScreen.setPublicSessionKeyboardLayouts", 1309 CallJS("login.AccountPickerScreen.setPublicSessionKeyboardLayouts",
1307 user_id, 1310 user_id.GetUserEmail(),
1308 locale, 1311 locale,
1309 *keyboard_layouts); 1312 *keyboard_layouts);
1310 } 1313 }
1311 1314
1312 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, 1315 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id,
1313 bool diagnostic_mode) { 1316 bool diagnostic_mode) {
1314 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); 1317 const user_manager::UserID app_user_id(user_manager::UserID::FromUserEmail(app _id));
1318 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_user_id);
1315 SigninSpecifics specifics; 1319 SigninSpecifics specifics;
1316 specifics.kiosk_diagnostic_mode = diagnostic_mode; 1320 specifics.kiosk_diagnostic_mode = diagnostic_mode;
1317 if (delegate_) 1321 if (delegate_)
1318 delegate_->Login(context, specifics); 1322 delegate_->Login(context, specifics);
1319 } 1323 }
1320 1324
1321 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() { 1325 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() {
1322 policy::ConsumerManagementService* consumer_management = 1326 policy::ConsumerManagementService* consumer_management =
1323 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> 1327 g_browser_process->platform_part()->browser_policy_connector_chromeos()->
1324 GetConsumerManagementService(); 1328 GetConsumerManagementService();
(...skipping 20 matching lines...) Expand all
1345 const std::string& email) { 1349 const std::string& email) {
1346 // TODO(ginkage): Fix this case once crbug.com/469987 is ready. 1350 // TODO(ginkage): Fix this case once crbug.com/469987 is ready.
1347 /* 1351 /*
1348 if (user_manager::UserManager::Get()->FindUsingSAML(email)) 1352 if (user_manager::UserManager::Get()->FindUsingSAML(email))
1349 RecordReauthReason(email, ReauthReason::INCORRECT_SAML_PASSWORD_ENTERED); 1353 RecordReauthReason(email, ReauthReason::INCORRECT_SAML_PASSWORD_ENTERED);
1350 */ 1354 */
1351 } 1355 }
1352 1356
1353 void SigninScreenHandler::HandleMaxIncorrectPasswordAttempts( 1357 void SigninScreenHandler::HandleMaxIncorrectPasswordAttempts(
1354 const std::string& email) { 1358 const std::string& email) {
1355 RecordReauthReason(email, ReauthReason::INCORRECT_PASSWORD_ENTERED); 1359 RecordReauthReason(user_manager::UserID::FromUserEmail(email), ReauthReason::I NCORRECT_PASSWORD_ENTERED);
1356 } 1360 }
1357 1361
1358 bool SigninScreenHandler::AllWhitelistedUsersPresent() { 1362 bool SigninScreenHandler::AllWhitelistedUsersPresent() {
1359 CrosSettings* cros_settings = CrosSettings::Get(); 1363 CrosSettings* cros_settings = CrosSettings::Get();
1360 bool allow_new_user = false; 1364 bool allow_new_user = false;
1361 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1365 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1362 if (allow_new_user) 1366 if (allow_new_user)
1363 return false; 1367 return false;
1364 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 1368 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
1365 const user_manager::UserList& users = user_manager->GetUsers(); 1369 const user_manager::UserList& users = user_manager->GetUsers();
1366 if (!delegate_ || users.size() > kMaxUsers) { 1370 if (!delegate_ || users.size() > kMaxUsers) {
1367 return false; 1371 return false;
1368 } 1372 }
1369 const base::ListValue* whitelist = NULL; 1373 const base::ListValue* whitelist = NULL;
1370 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist) 1374 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist)
1371 return false; 1375 return false;
1372 for (size_t i = 0; i < whitelist->GetSize(); ++i) { 1376 for (size_t i = 0; i < whitelist->GetSize(); ++i) {
1373 std::string whitelisted_user; 1377 std::string whitelisted_user;
1374 // NB: Wildcards in the whitelist are also detected as not present here. 1378 // NB: Wildcards in the whitelist are also detected as not present here.
1375 if (!whitelist->GetString(i, &whitelisted_user) || 1379 if (!whitelist->GetString(i, &whitelisted_user) ||
1376 !user_manager->IsKnownUser(whitelisted_user)) { 1380 !user_manager->IsKnownUser(user_manager::UserID::FromUserEmail(whitelist ed_user))) {
1377 return false; 1381 return false;
1378 } 1382 }
1379 } 1383 }
1380 return true; 1384 return true;
1381 } 1385 }
1382 1386
1383 void SigninScreenHandler::CancelPasswordChangedFlowInternal() { 1387 void SigninScreenHandler::CancelPasswordChangedFlowInternal() {
1384 if (delegate_) { 1388 if (delegate_) {
1385 ShowImpl(); 1389 ShowImpl();
1386 delegate_->CancelPasswordChangedFlow(); 1390 delegate_->CancelPasswordChangedFlow();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 return gaia_screen_handler_->frame_error(); 1449 return gaia_screen_handler_->frame_error();
1446 } 1450 }
1447 1451
1448 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { 1452 void SigninScreenHandler::OnCapsLockChanged(bool enabled) {
1449 caps_lock_enabled_ = enabled; 1453 caps_lock_enabled_ = enabled;
1450 if (page_is_ready()) 1454 if (page_is_ready())
1451 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); 1455 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_);
1452 } 1456 }
1453 1457
1454 } // namespace chromeos 1458 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698