| 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..f7b502ee050b0b114357286510a3cfc4db5a55d9 100644
|
| --- a/chrome/browser/signin/signin_tracker.cc
|
| +++ b/chrome/browser/signin/signin_tracker.cc
|
| @@ -6,14 +6,19 @@
|
|
|
| #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/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"
|
|
|
| +#if !defined(OS_CHROMEOS)
|
| +#include "chrome/browser/signin/signin_manager.h"
|
| +#include "chrome/browser/signin/signin_manager_factory.h"
|
| +#endif
|
| +
|
| SigninTracker::SigninTracker(Profile* profile, Observer* observer)
|
| : profile_(profile), observer_(observer) {
|
| DCHECK(profile_);
|
| @@ -23,6 +28,18 @@ SigninTracker::SigninTracker(Profile* profile, Observer* observer)
|
| SigninTracker::~SigninTracker() {
|
| ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
|
| RemoveObserver(this);
|
| +
|
| + if (!switches::IsEnableWebBasedSignin()) {
|
| + if (switches::IsNewProfileManagement()) {
|
| + AccountReconcilorFactory::GetForProfile(profile_)->
|
| + RemoveMergeSessionObserver(this);
|
| +#if !defined(OS_CHROMEOS)
|
| + } else {
|
| + SigninManagerFactory::GetForProfile(profile_)->
|
| + RemoveMergeSessionObserver(this);
|
| +#endif
|
| + }
|
| + }
|
| }
|
|
|
| void SigninTracker::Initialize() {
|
| @@ -52,9 +69,27 @@ 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::IsEnableWebBasedSignin()) {
|
| + if (switches::IsNewProfileManagement()) {
|
| + AccountReconcilorFactory::GetForProfile(profile_)->
|
| + AddMergeSessionObserver(this);
|
| +#if !defined(OS_CHROMEOS)
|
| + } else {
|
| + SigninManagerFactory::GetForProfile(profile_)->
|
| + AddMergeSessionObserver(this);
|
| +#endif
|
| + }
|
| + }
|
| +
|
| 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);
|
| +}
|
|
|