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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 const std::string& password, | 1137 const std::string& password, |
1138 bool using_saml) { | 1138 bool using_saml) { |
1139 if (!delegate_) | 1139 if (!delegate_) |
1140 return; | 1140 return; |
1141 | 1141 |
1142 if (using_saml && !using_saml_api_) | 1142 if (using_saml && !using_saml_api_) |
1143 RecordSAMLScrapingVerificationResultInHistogram(true); | 1143 RecordSAMLScrapingVerificationResultInHistogram(true); |
1144 | 1144 |
1145 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); | 1145 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); |
1146 delegate_->SetDisplayEmail(sanitized_email); | 1146 delegate_->SetDisplayEmail(sanitized_email); |
1147 delegate_->CompleteLogin(UserContext( | 1147 UserContext user_context(sanitized_email); |
1148 sanitized_email, | 1148 user_context.SetPassword(password); |
1149 password, | 1149 user_context.SetAuthFlow(using_saml ? |
1150 std::string(), // auth_code | 1150 UserContext::AUTH_FLOW_GAIA_WITH_SAML : |
1151 std::string(), // username_hash | 1151 UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); |
1152 true, // using_oauth | 1152 delegate_->CompleteLogin(user_context); |
1153 using_saml ? UserContext::AUTH_FLOW_GAIA_WITH_SAML | |
1154 : UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML)); | |
1155 | 1153 |
1156 if (test_expects_complete_login_) { | 1154 if (test_expects_complete_login_) { |
1157 VLOG(2) << "Complete test login for " << typed_email | 1155 VLOG(2) << "Complete test login for " << typed_email |
1158 << ", requested=" << test_user_; | 1156 << ", requested=" << test_user_; |
1159 | 1157 |
1160 test_expects_complete_login_ = false; | 1158 test_expects_complete_login_ = false; |
1161 test_user_.clear(); | 1159 test_user_.clear(); |
1162 test_pass_.clear(); | 1160 test_pass_.clear(); |
1163 } | 1161 } |
1164 } | 1162 } |
1165 | 1163 |
1166 void SigninScreenHandler::HandleCompleteAuthentication( | 1164 void SigninScreenHandler::HandleCompleteAuthentication( |
1167 const std::string& email, | 1165 const std::string& email, |
1168 const std::string& password, | 1166 const std::string& password, |
1169 const std::string& auth_code) { | 1167 const std::string& auth_code) { |
1170 if (!delegate_) | 1168 if (!delegate_) |
1171 return; | 1169 return; |
1172 const std::string sanitized_email = gaia::SanitizeEmail(email); | 1170 delegate_->SetDisplayEmail(gaia::SanitizeEmail(email)); |
1173 delegate_->SetDisplayEmail(sanitized_email); | 1171 UserContext user_context(email); |
1174 delegate_->CompleteLogin(UserContext(sanitized_email, password, auth_code)); | 1172 user_context.SetPassword(password); |
| 1173 user_context.SetAuthCode(auth_code); |
| 1174 delegate_->CompleteLogin(user_context); |
1175 } | 1175 } |
1176 | 1176 |
1177 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, | 1177 void SigninScreenHandler::HandleAuthenticateUser(const std::string& username, |
1178 const std::string& password) { | 1178 const std::string& password) { |
1179 if (!delegate_) | 1179 if (!delegate_) |
1180 return; | 1180 return; |
1181 delegate_->Login(UserContext(gaia::SanitizeEmail(username), | 1181 UserContext user_context(username); |
1182 password, | 1182 user_context.SetPassword(password); |
1183 std::string())); // auth_code | 1183 delegate_->Login(user_context); |
1184 } | 1184 } |
1185 | 1185 |
1186 void SigninScreenHandler::HandleLaunchDemoUser() { | 1186 void SigninScreenHandler::HandleLaunchDemoUser() { |
1187 if (delegate_) | 1187 if (delegate_) |
1188 delegate_->LoginAsRetailModeUser(); | 1188 delegate_->LoginAsRetailModeUser(); |
1189 } | 1189 } |
1190 | 1190 |
1191 void SigninScreenHandler::HandleLaunchIncognito() { | 1191 void SigninScreenHandler::HandleLaunchIncognito() { |
1192 if (delegate_) | 1192 if (delegate_) |
1193 delegate_->LoginAsGuest(); | 1193 delegate_->LoginAsGuest(); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 DCHECK(gaia_screen_handler_); | 1785 DCHECK(gaia_screen_handler_); |
1786 return gaia_screen_handler_->frame_state(); | 1786 return gaia_screen_handler_->frame_state(); |
1787 } | 1787 } |
1788 | 1788 |
1789 net::Error SigninScreenHandler::FrameError() const { | 1789 net::Error SigninScreenHandler::FrameError() const { |
1790 DCHECK(gaia_screen_handler_); | 1790 DCHECK(gaia_screen_handler_); |
1791 return gaia_screen_handler_->frame_error(); | 1791 return gaia_screen_handler_->frame_error(); |
1792 } | 1792 } |
1793 | 1793 |
1794 } // namespace chromeos | 1794 } // namespace chromeos |
OLD | NEW |