| 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 <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 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 26 #include "chrome/browser/browser_shutdown.h" | 26 #include "chrome/browser/browser_shutdown.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 29 #include "chrome/browser/chromeos/boot_times_loader.h" | 29 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 30 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 30 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 32 #include "chrome/browser/chromeos/login/auth/key.h" |
| 32 #include "chrome/browser/chromeos/login/auth/user_context.h" | 33 #include "chrome/browser/chromeos/login/auth/user_context.h" |
| 33 #include "chrome/browser/chromeos/login/hwid_checker.h" | 34 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 34 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 35 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 35 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 36 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 37 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 37 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 38 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 38 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 39 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 39 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 40 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 40 #include "chrome/browser/chromeos/login/users/user.h" | 41 #include "chrome/browser/chromeos/login/users/user.h" |
| 41 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 42 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 bool using_saml) { | 1169 bool using_saml) { |
| 1169 if (!delegate_) | 1170 if (!delegate_) |
| 1170 return; | 1171 return; |
| 1171 | 1172 |
| 1172 if (using_saml && !using_saml_api_) | 1173 if (using_saml && !using_saml_api_) |
| 1173 RecordSAMLScrapingVerificationResultInHistogram(true); | 1174 RecordSAMLScrapingVerificationResultInHistogram(true); |
| 1174 | 1175 |
| 1175 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); | 1176 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); |
| 1176 delegate_->SetDisplayEmail(sanitized_email); | 1177 delegate_->SetDisplayEmail(sanitized_email); |
| 1177 UserContext user_context(sanitized_email); | 1178 UserContext user_context(sanitized_email); |
| 1178 user_context.SetPassword(password); | 1179 user_context.SetKey(Key(password)); |
| 1179 user_context.SetAuthFlow(using_saml ? | 1180 user_context.SetAuthFlow(using_saml ? |
| 1180 UserContext::AUTH_FLOW_GAIA_WITH_SAML : | 1181 UserContext::AUTH_FLOW_GAIA_WITH_SAML : |
| 1181 UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); | 1182 UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); |
| 1182 delegate_->CompleteLogin(user_context); | 1183 delegate_->CompleteLogin(user_context); |
| 1183 | 1184 |
| 1184 if (test_expects_complete_login_) { | 1185 if (test_expects_complete_login_) { |
| 1185 VLOG(2) << "Complete test login for " << typed_email | 1186 VLOG(2) << "Complete test login for " << typed_email |
| 1186 << ", requested=" << test_user_; | 1187 << ", requested=" << test_user_; |
| 1187 | 1188 |
| 1188 test_expects_complete_login_ = false; | 1189 test_expects_complete_login_ = false; |
| 1189 test_user_.clear(); | 1190 test_user_.clear(); |
| 1190 test_pass_.clear(); | 1191 test_pass_.clear(); |
| 1191 } | 1192 } |
| 1192 } | 1193 } |
| 1193 | 1194 |
| 1194 void SigninScreenHandler::HandleCompleteAuthentication( | 1195 void SigninScreenHandler::HandleCompleteAuthentication( |
| 1195 const std::string& email, | 1196 const std::string& email, |
| 1196 const std::string& password, | 1197 const std::string& password, |
| 1197 const std::string& auth_code) { | 1198 const std::string& auth_code) { |
| 1198 if (!delegate_) | 1199 if (!delegate_) |
| 1199 return; | 1200 return; |
| 1200 delegate_->SetDisplayEmail(gaia::SanitizeEmail(email)); | 1201 delegate_->SetDisplayEmail(gaia::SanitizeEmail(email)); |
| 1201 UserContext user_context(email); | 1202 UserContext user_context(email); |
| 1202 user_context.SetPassword(password); | 1203 user_context.SetKey(Key(password)); |
| 1203 user_context.SetAuthCode(auth_code); | 1204 user_context.SetAuthCode(auth_code); |
| 1204 delegate_->CompleteLogin(user_context); | 1205 delegate_->CompleteLogin(user_context); |
| 1205 } | 1206 } |
| 1206 | 1207 |
| 1207 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, | 1208 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, |
| 1208 const std::string& password) { | 1209 const std::string& password) { |
| 1209 if (!delegate_) | 1210 if (!delegate_) |
| 1210 return; | 1211 return; |
| 1211 UserContext user_context(username); | 1212 UserContext user_context(username); |
| 1212 user_context.SetPassword(password); | 1213 user_context.SetKey(Key(password)); |
| 1213 delegate_->Login(user_context); | 1214 delegate_->Login(user_context); |
| 1214 } | 1215 } |
| 1215 | 1216 |
| 1216 void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { | 1217 void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { |
| 1217 DCHECK(ScreenLocker::default_screen_locker()); | 1218 DCHECK(ScreenLocker::default_screen_locker()); |
| 1218 | 1219 |
| 1219 const User* unlock_user = NULL; | 1220 const User* unlock_user = NULL; |
| 1220 const UserList& users = delegate_->GetUsers(); | 1221 const UserList& users = delegate_->GetUsers(); |
| 1221 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 1222 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 1222 if ((*it)->email() == username) { | 1223 if ((*it)->email() == username) { |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 return gaia_screen_handler_->frame_error(); | 1834 return gaia_screen_handler_->frame_error(); |
| 1834 } | 1835 } |
| 1835 | 1836 |
| 1836 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1837 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1837 caps_lock_enabled_ = enabled; | 1838 caps_lock_enabled_ = enabled; |
| 1838 if (page_is_ready()) | 1839 if (page_is_ready()) |
| 1839 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1840 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1840 } | 1841 } |
| 1841 | 1842 |
| 1842 } // namespace chromeos | 1843 } // namespace chromeos |
| OLD | NEW |