OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 if (frame_state_ == FRAME_STATE_LOADED) | 395 if (frame_state_ == FRAME_STATE_LOADED) |
396 UpdateState(NetworkError::ERROR_REASON_UPDATE); | 396 UpdateState(NetworkError::ERROR_REASON_UPDATE); |
397 else if (frame_state_ == FRAME_STATE_ERROR) | 397 else if (frame_state_ == FRAME_STATE_ERROR) |
398 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR); | 398 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR); |
399 } | 399 } |
400 | 400 |
401 void GaiaScreenHandler::HandleCompleteAuthentication( | 401 void GaiaScreenHandler::HandleCompleteAuthentication( |
402 const std::string& gaia_id, | 402 const std::string& gaia_id, |
403 const std::string& email, | 403 const std::string& email, |
404 const std::string& password, | 404 const std::string& password, |
405 const std::string& auth_code) { | 405 const std::string& auth_code, |
| 406 bool using_saml) { |
406 if (!Delegate()) | 407 if (!Delegate()) |
407 return; | 408 return; |
408 | 409 |
409 RecordGAIAFlowTypeHistogram(); | 410 RecordGAIAFlowTypeHistogram(); |
410 | 411 |
411 DCHECK(!email.empty()); | 412 DCHECK(!email.empty()); |
412 DCHECK(!gaia_id.empty()); | 413 DCHECK(!gaia_id.empty()); |
413 const std::string sanitized_email = gaia::SanitizeEmail(email); | 414 const std::string sanitized_email = gaia::SanitizeEmail(email); |
414 Delegate()->SetDisplayEmail(sanitized_email); | 415 Delegate()->SetDisplayEmail(sanitized_email); |
415 UserContext user_context(sanitized_email); | 416 UserContext user_context(sanitized_email); |
416 user_context.SetGaiaID(gaia_id); | 417 user_context.SetGaiaID(gaia_id); |
417 user_context.SetKey(Key(password)); | 418 user_context.SetKey(Key(password)); |
418 user_context.SetAuthCode(auth_code); | 419 user_context.SetAuthCode(auth_code); |
| 420 user_context.SetAuthFlow(using_saml |
| 421 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML |
| 422 : UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); |
419 Delegate()->CompleteLogin(user_context); | 423 Delegate()->CompleteLogin(user_context); |
420 } | 424 } |
421 | 425 |
422 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( | 426 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( |
423 const std::string& auth_code) { | 427 const std::string& auth_code) { |
424 if (!Delegate()) | 428 if (!Delegate()) |
425 return; | 429 return; |
426 | 430 |
427 RecordGAIAFlowTypeHistogram(); | 431 RecordGAIAFlowTypeHistogram(); |
428 | 432 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 825 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
822 DCHECK(signin_screen_handler_); | 826 DCHECK(signin_screen_handler_); |
823 return signin_screen_handler_->delegate_; | 827 return signin_screen_handler_->delegate_; |
824 } | 828 } |
825 | 829 |
826 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 830 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
827 signin_screen_handler_ = handler; | 831 signin_screen_handler_ = handler; |
828 } | 832 } |
829 | 833 |
830 } // namespace chromeos | 834 } // namespace chromeos |
OLD | NEW |