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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 params->SetBoolean("createAccount", false); | 114 params->SetBoolean("createAccount", false); |
115 params->SetBoolean("guestSignin", false); | 115 params->SetBoolean("guestSignin", false); |
116 params->SetBoolean("supervisedUsersEnabled", false); | 116 params->SetBoolean("supervisedUsersEnabled", false); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 void RecordSAMLScrapingVerificationResultInHistogram(bool success) { | 120 void RecordSAMLScrapingVerificationResultInHistogram(bool success) { |
121 UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.Scraping.VerificationResult", success); | 121 UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.Scraping.VerificationResult", success); |
122 } | 122 } |
123 | 123 |
| 124 void RecordGAIAFlowTypeHistogram() { |
| 125 UMA_HISTOGRAM_BOOLEAN("ChromeOS.GAIA.WebViewFlow", |
| 126 StartupUtils::IsWebviewSigninEnabled()); |
| 127 } |
| 128 |
124 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO | 129 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO |
125 // thread. | 130 // thread. |
126 void ClearDnsCache(IOThread* io_thread) { | 131 void ClearDnsCache(IOThread* io_thread) { |
127 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 132 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
128 if (browser_shutdown::IsTryingToQuit()) | 133 if (browser_shutdown::IsTryingToQuit()) |
129 return; | 134 return; |
130 | 135 |
131 io_thread->ClearHostCache(); | 136 io_thread->ClearHostCache(); |
132 } | 137 } |
133 | 138 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 418 } |
414 | 419 |
415 void GaiaScreenHandler::HandleCompleteAuthentication( | 420 void GaiaScreenHandler::HandleCompleteAuthentication( |
416 const std::string& gaia_id, | 421 const std::string& gaia_id, |
417 const std::string& email, | 422 const std::string& email, |
418 const std::string& password, | 423 const std::string& password, |
419 const std::string& auth_code) { | 424 const std::string& auth_code) { |
420 if (!Delegate()) | 425 if (!Delegate()) |
421 return; | 426 return; |
422 | 427 |
| 428 RecordGAIAFlowTypeHistogram(); |
| 429 |
423 DCHECK(!email.empty()); | 430 DCHECK(!email.empty()); |
424 DCHECK(!gaia_id.empty()); | 431 DCHECK(!gaia_id.empty()); |
425 const std::string sanitized_email = gaia::SanitizeEmail(email); | 432 const std::string sanitized_email = gaia::SanitizeEmail(email); |
426 Delegate()->SetDisplayEmail(sanitized_email); | 433 Delegate()->SetDisplayEmail(sanitized_email); |
427 UserContext user_context(sanitized_email); | 434 UserContext user_context(sanitized_email); |
428 user_context.SetGaiaID(gaia_id); | 435 user_context.SetGaiaID(gaia_id); |
429 user_context.SetKey(Key(password)); | 436 user_context.SetKey(Key(password)); |
430 user_context.SetAuthCode(auth_code); | 437 user_context.SetAuthCode(auth_code); |
431 Delegate()->CompleteLogin(user_context); | 438 Delegate()->CompleteLogin(user_context); |
432 } | 439 } |
433 | 440 |
434 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( | 441 void GaiaScreenHandler::HandleCompleteAuthenticationAuthCodeOnly( |
435 const std::string& auth_code) { | 442 const std::string& auth_code) { |
436 if (!Delegate()) | 443 if (!Delegate()) |
437 return; | 444 return; |
438 | 445 |
| 446 RecordGAIAFlowTypeHistogram(); |
| 447 |
439 UserContext user_context; | 448 UserContext user_context; |
440 user_context.SetAuthFlow(UserContext::AUTH_FLOW_EASY_BOOTSTRAP); | 449 user_context.SetAuthFlow(UserContext::AUTH_FLOW_EASY_BOOTSTRAP); |
441 user_context.SetAuthCode(auth_code); | 450 user_context.SetAuthCode(auth_code); |
442 Delegate()->CompleteLogin(user_context); | 451 Delegate()->CompleteLogin(user_context); |
443 } | 452 } |
444 | 453 |
445 void GaiaScreenHandler::HandleCompleteLogin(const std::string& gaia_id, | 454 void GaiaScreenHandler::HandleCompleteLogin(const std::string& gaia_id, |
446 const std::string& typed_email, | 455 const std::string& typed_email, |
447 const std::string& password, | 456 const std::string& password, |
448 bool using_saml) { | 457 bool using_saml) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 579 |
571 void GaiaScreenHandler::DoCompleteLogin(const std::string& gaia_id, | 580 void GaiaScreenHandler::DoCompleteLogin(const std::string& gaia_id, |
572 const std::string& typed_email, | 581 const std::string& typed_email, |
573 const std::string& password, | 582 const std::string& password, |
574 bool using_saml) { | 583 bool using_saml) { |
575 if (!Delegate()) | 584 if (!Delegate()) |
576 return; | 585 return; |
577 | 586 |
578 if (using_saml && !using_saml_api_) | 587 if (using_saml && !using_saml_api_) |
579 RecordSAMLScrapingVerificationResultInHistogram(true); | 588 RecordSAMLScrapingVerificationResultInHistogram(true); |
| 589 RecordGAIAFlowTypeHistogram(); |
580 | 590 |
581 DCHECK(!typed_email.empty()); | 591 DCHECK(!typed_email.empty()); |
582 DCHECK(!gaia_id.empty()); | 592 DCHECK(!gaia_id.empty()); |
583 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); | 593 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); |
584 Delegate()->SetDisplayEmail(sanitized_email); | 594 Delegate()->SetDisplayEmail(sanitized_email); |
585 UserContext user_context(sanitized_email); | 595 UserContext user_context(sanitized_email); |
586 user_context.SetGaiaID(gaia_id); | 596 user_context.SetGaiaID(gaia_id); |
587 user_context.SetKey(Key(password)); | 597 user_context.SetKey(Key(password)); |
588 user_context.SetAuthFlow(using_saml | 598 user_context.SetAuthFlow(using_saml |
589 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML | 599 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 848 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
839 DCHECK(signin_screen_handler_); | 849 DCHECK(signin_screen_handler_); |
840 return signin_screen_handler_->delegate_; | 850 return signin_screen_handler_->delegate_; |
841 } | 851 } |
842 | 852 |
843 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 853 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
844 signin_screen_handler_ = handler; | 854 signin_screen_handler_ = handler; |
845 } | 855 } |
846 | 856 |
847 } // namespace chromeos | 857 } // namespace chromeos |
OLD | NEW |