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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if (frame_state_ == FRAME_STATE_LOADED) | 396 if (frame_state_ == FRAME_STATE_LOADED) |
397 UpdateState(NetworkError::ERROR_REASON_UPDATE); | 397 UpdateState(NetworkError::ERROR_REASON_UPDATE); |
398 else if (frame_state_ == FRAME_STATE_ERROR) | 398 else if (frame_state_ == FRAME_STATE_ERROR) |
399 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR); | 399 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR); |
400 } | 400 } |
401 | 401 |
402 void GaiaScreenHandler::HandleCompleteAuthentication( | 402 void GaiaScreenHandler::HandleCompleteAuthentication( |
403 const std::string& gaia_id, | 403 const std::string& gaia_id, |
404 const std::string& email, | 404 const std::string& email, |
405 const std::string& password, | 405 const std::string& password, |
406 const std::string& auth_code) { | 406 const std::string& auth_code, |
| 407 bool using_saml) { |
407 if (!Delegate()) | 408 if (!Delegate()) |
408 return; | 409 return; |
409 | 410 |
410 RecordGAIAFlowTypeHistogram(); | 411 RecordGAIAFlowTypeHistogram(); |
411 | 412 |
412 DCHECK(!email.empty()); | 413 DCHECK(!email.empty()); |
413 DCHECK(!gaia_id.empty()); | 414 DCHECK(!gaia_id.empty()); |
414 const std::string sanitized_email = gaia::SanitizeEmail(email); | 415 const std::string sanitized_email = gaia::SanitizeEmail(email); |
415 Delegate()->SetDisplayEmail(sanitized_email); | 416 Delegate()->SetDisplayEmail(sanitized_email); |
416 UserContext user_context(sanitized_email); | 417 UserContext user_context(sanitized_email); |
417 user_context.SetGaiaID(gaia_id); | 418 user_context.SetGaiaID(gaia_id); |
418 user_context.SetKey(Key(password)); | 419 user_context.SetKey(Key(password)); |
419 user_context.SetAuthCode(auth_code); | 420 user_context.SetAuthCode(auth_code); |
| 421 user_context.SetAuthFlow(using_saml |
| 422 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML |
| 423 : UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); |
420 Delegate()->CompleteLogin(user_context); | 424 Delegate()->CompleteLogin(user_context); |
421 } | 425 } |
422 | 426 |
423 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( | 427 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( |
424 const std::string& auth_code) { | 428 const std::string& auth_code) { |
425 if (!Delegate()) | 429 if (!Delegate()) |
426 return; | 430 return; |
427 | 431 |
428 RecordGAIAFlowTypeHistogram(); | 432 RecordGAIAFlowTypeHistogram(); |
429 | 433 |
(...skipping 391 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 |