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/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 } | 447 } |
448 break; | 448 break; |
449 default: | 449 default: |
450 DCHECK(false) << "Invalid action"; | 450 DCHECK(false) << "Invalid action"; |
451 } | 451 } |
452 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 452 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
453 } | 453 } |
454 | 454 |
455 void InlineSigninHelper::OnClientOAuthFailure( | 455 void InlineSigninHelper::OnClientOAuthFailure( |
456 const GoogleServiceAuthError& error) { | 456 const GoogleServiceAuthError& error) { |
457 LoginUIServiceFactory::GetForProfile(profile_)->SetLastLoginErrorEmail( | |
458 base::string16()); | |
457 if (handler_) | 459 if (handler_) |
458 handler_->HandleLoginError(error.ToString()); | 460 handler_->HandleLoginError(error.ToString()); |
459 | 461 |
460 AboutSigninInternals* about_signin_internals = | 462 AboutSigninInternals* about_signin_internals = |
461 AboutSigninInternalsFactory::GetForProfile(profile_); | 463 AboutSigninInternalsFactory::GetForProfile(profile_); |
462 about_signin_internals->OnRefreshTokenReceived("Failure"); | 464 about_signin_internals->OnRefreshTokenReceived("Failure"); |
463 | 465 |
464 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 466 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
465 } | 467 } |
466 | 468 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 // gaia sign in page, but signs in to a different account in the SAML sign in | 775 // gaia sign in page, but signs in to a different account in the SAML sign in |
774 // page. | 776 // page. |
775 std::string default_email; | 777 std::string default_email; |
776 std::string validate_email; | 778 std::string validate_email; |
777 if (net::GetValueForKeyInQuery(params.url, "email", &default_email) && | 779 if (net::GetValueForKeyInQuery(params.url, "email", &default_email) && |
778 net::GetValueForKeyInQuery(params.url, "validateEmail", | 780 net::GetValueForKeyInQuery(params.url, "validateEmail", |
779 &validate_email) && | 781 &validate_email) && |
780 validate_email == "1") { | 782 validate_email == "1") { |
781 if (!gaia::AreEmailsSame(params.email, default_email)) { | 783 if (!gaia::AreEmailsSame(params.email, default_email)) { |
782 if (params.handler) { | 784 if (params.handler) { |
785 LoginUIServiceFactory::GetForProfile(profile)->SetLastLoginErrorEmail( | |
786 base::UTF8ToUTF16(params.email)); | |
783 params.handler->HandleLoginError( | 787 params.handler->HandleLoginError( |
784 l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, | 788 l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, |
785 base::UTF8ToUTF16(default_email))); | 789 base::UTF8ToUTF16(default_email))); |
786 } | 790 } |
787 return; | 791 return; |
788 } | 792 } |
789 } | 793 } |
790 | 794 |
791 signin_metrics::AccessPoint access_point = | 795 signin_metrics::AccessPoint access_point = |
792 signin::GetAccessPointForPromoURL(params.url); | 796 signin::GetAccessPointForPromoURL(params.url); |
(...skipping 24 matching lines...) Expand all Loading... | |
817 } | 821 } |
818 default: | 822 default: |
819 // No need to change |can_offer_for|. | 823 // No need to change |can_offer_for|. |
820 break; | 824 break; |
821 } | 825 } |
822 | 826 |
823 std::string error_msg; | 827 std::string error_msg; |
824 bool can_offer = CanOffer(profile, can_offer_for, params.gaia_id, | 828 bool can_offer = CanOffer(profile, can_offer_for, params.gaia_id, |
825 params.email, &error_msg); | 829 params.email, &error_msg); |
826 if (!can_offer) { | 830 if (!can_offer) { |
827 if (params.handler) | 831 if (params.handler) { |
832 LoginUIServiceFactory::GetForProfile(profile)->SetLastLoginErrorEmail( | |
833 base::UTF8ToUTF16(params.email)); | |
828 params.handler->HandleLoginError(error_msg); | 834 params.handler->HandleLoginError(error_msg); |
tommycli
2016/08/23 19:15:39
Instead of setting a global SetLastLoginErrorEmail
Jane
2016/08/24 13:40:31
Done.
| |
835 } | |
829 return; | 836 return; |
830 } | 837 } |
831 | 838 |
832 AboutSigninInternals* about_signin_internals = | 839 AboutSigninInternals* about_signin_internals = |
833 AboutSigninInternalsFactory::GetForProfile(profile); | 840 AboutSigninInternalsFactory::GetForProfile(profile); |
834 about_signin_internals->OnAuthenticationResultReceived("Successful"); | 841 about_signin_internals->OnAuthenticationResultReceived("Successful"); |
835 | 842 |
836 SigninClient* signin_client = | 843 SigninClient* signin_client = |
837 ChromeSigninClientFactory::GetForProfile(profile); | 844 ChromeSigninClientFactory::GetForProfile(profile); |
838 std::string signin_scoped_device_id = | 845 std::string signin_scoped_device_id = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
933 } | 940 } |
934 | 941 |
935 if (show_account_management) { | 942 if (show_account_management) { |
936 browser->window()->ShowAvatarBubbleFromAvatarButton( | 943 browser->window()->ShowAvatarBubbleFromAvatarButton( |
937 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 944 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
938 signin::ManageAccountsParams(), | 945 signin::ManageAccountsParams(), |
939 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); | 946 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
940 } | 947 } |
941 } | 948 } |
942 } | 949 } |
OLD | NEW |