Chromium Code Reviews| Index: chrome/browser/signin/signin_tracker.cc |
| diff --git a/chrome/browser/signin/signin_tracker.cc b/chrome/browser/signin/signin_tracker.cc |
| index 65c8154aa1229d2bbcbb913c8a6fb406ceb2e3f3..be3367786bab9294abc33e14e0d786740ba74a2b 100644 |
| --- a/chrome/browser/signin/signin_tracker.cc |
| +++ b/chrome/browser/signin/signin_tracker.cc |
| @@ -6,10 +6,13 @@ |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/signin/account_reconcilor_factory.h" |
| +#include "chrome/browser/signin/google_auto_login_helper.h" |
| #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| #include "chrome/browser/signin/signin_manager.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| +#include "chrome/common/profile_management_switches.h" |
| #include "content/public/browser/notification_details.h" |
| #include "content/public/browser/notification_source.h" |
| #include "google_apis/gaia/gaia_constants.h" |
| @@ -23,6 +26,14 @@ SigninTracker::SigninTracker(Profile* profile, Observer* observer) |
| SigninTracker::~SigninTracker() { |
| ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
| RemoveObserver(this); |
| + |
| + if (merge_session_helper_) |
| + merge_session_helper_->RemoveObserver(this); |
| + |
| + if (switches::IsEnableInlineSignin() && switches::IsNewProfileManagement()) { |
| + AccountReconcilorFactory::GetForProfile(profile_)-> |
| + RemoveMergeSessionObserver(this); |
| + } |
| } |
| void SigninTracker::Initialize() { |
| @@ -52,9 +63,25 @@ void SigninTracker::Observe(int type, |
| void SigninTracker::OnRefreshTokenAvailable(const std::string& account_id) { |
| // TODO: when OAuth2TokenService handles multi-login, this should check |
| // that |account_id| is the primary account before signalling success. |
| + if (switches::IsEnableInlineSignin()) { |
| + if (switches::IsNewProfileManagement()) { |
| + AccountReconcilorFactory::GetForProfile(profile_)-> |
| + AddMergeSessionObserver(this); |
| + } else { |
| + merge_session_helper_.reset(new GoogleAutoLoginHelper(profile_, this)); |
|
guohui
2013/12/20 16:11:09
It looks wierd to me to create a GoogleAutoLoginHe
Roger Tawa OOO till Jul 10th
2013/12/20 20:02:01
Agreed, does not make sense to do this in the trac
|
| + merge_session_helper_->LogIn(account_id); |
| + } |
| + } |
| + |
| observer_->SigninSuccess(); |
| } |
| void SigninTracker::OnRefreshTokenRevoked(const std::string& account_id) { |
| NOTREACHED(); |
| } |
| + |
| +void SigninTracker::MergeSessionCompleted( |
| + const std::string& account_id, |
| + const GoogleServiceAuthError& error) { |
| + observer_->MergeSessionComplete(error); |
| +} |