OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); | 604 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); |
605 | 605 |
606 // Don't store password hash except for users of new profile features. | 606 // Don't store password hash except for users of new profile features. |
607 if (CommandLine::ForCurrentProcess()->HasSwitch( | 607 if (CommandLine::ForCurrentProcess()->HasSwitch( |
608 switches::kNewProfileManagement)) { | 608 switches::kNewProfileManagement)) { |
609 std::string auth_username = GetAuthenticatedUsername(); | 609 std::string auth_username = GetAuthenticatedUsername(); |
610 chrome::SetLocalAuthCredentials(profile_, auth_username, password_); | 610 chrome::SetLocalAuthCredentials(profile_, auth_username, password_); |
611 } | 611 } |
612 password_.clear(); // Don't need it anymore. | 612 password_.clear(); // Don't need it anymore. |
613 DisableOneClickSignIn(profile_); // Don't ever offer again. | 613 DisableOneClickSignIn(profile_); // Don't ever offer again. |
614 | |
615 if (type_ == SIGNIN_TYPE_WITH_OAUTH_CODE && | |
616 !temp_oauth_login_tokens_.access_token.empty()) | |
617 // Cookie jar may not be set up properly, need to first get an uber token | |
618 // and then merge sessions with the token. | |
619 client_login_->StartTokenFetchForUberAuthExchange( | |
620 temp_oauth_login_tokens_.access_token); | |
621 } | |
622 | |
623 void SigninManager::OnUberAuthTokenSuccess(const std::string& token) { | |
624 DVLOG(1) << "SigninManager::OnUberAuthTokenSuccess"; | |
625 NotifyDiagnosticsObservers(UBER_TOKEN_STATUS, "Successful"); | |
626 client_login_->StartMergeSession(token); | |
627 } | |
628 | |
629 void SigninManager::OnMergeSessionSuccess(const std::string& data) { | |
630 DVLOG(1) << "SigninManager::OnMergeSessionSuccess"; | |
631 NotifyDiagnosticsObservers(MERGE_SESSION_STATUS, "Successful"); | |
632 } | |
633 | |
634 void SigninManager::OnMergeSessionFailure(const GoogleServiceAuthError& error) { | |
635 LOG(ERROR) << "Unable to mereg sessions. Login failed."; | |
636 NotifyDiagnosticsObservers(MERGE_SESSION_STATUS, error.ToString()); | |
637 } | |
638 | |
639 void SigninManager::OnUberAuthTokenFailure( | |
640 const GoogleServiceAuthError& error) { | |
641 LOG(ERROR) << "Unable to retreive the uber token. Login failed."; | |
642 NotifyDiagnosticsObservers(UBER_TOKEN_STATUS, error.ToString()); | |
643 } | 614 } |
644 | 615 |
645 void SigninManager::OnGetUserInfoFailure(const GoogleServiceAuthError& error) { | 616 void SigninManager::OnGetUserInfoFailure(const GoogleServiceAuthError& error) { |
646 LOG(ERROR) << "Unable to retreive the canonical email address. Login failed."; | 617 LOG(ERROR) << "Unable to retreive the canonical email address. Login failed."; |
647 NotifyDiagnosticsObservers(GET_USER_INFO_STATUS, error.ToString()); | 618 NotifyDiagnosticsObservers(GET_USER_INFO_STATUS, error.ToString()); |
648 // REVIEW: why does this call OnClientLoginFailure? | 619 // REVIEW: why does this call OnClientLoginFailure? |
649 OnClientLoginFailure(error); | 620 OnClientLoginFailure(error); |
650 } | 621 } |
651 | 622 |
652 void SigninManager::Observe(int type, | 623 void SigninManager::Observe(int type, |
(...skipping 14 matching lines...) Expand all Loading... |
667 } | 638 } |
668 } | 639 } |
669 | 640 |
670 void SigninManager::ProhibitSignout(bool prohibit_signout) { | 641 void SigninManager::ProhibitSignout(bool prohibit_signout) { |
671 prohibit_signout_ = prohibit_signout; | 642 prohibit_signout_ = prohibit_signout; |
672 } | 643 } |
673 | 644 |
674 bool SigninManager::IsSignoutProhibited() const { | 645 bool SigninManager::IsSignoutProhibited() const { |
675 return prohibit_signout_; | 646 return prohibit_signout_; |
676 } | 647 } |
OLD | NEW |