Index: chrome/browser/signin/signin_tracker.cc |
=================================================================== |
--- chrome/browser/signin/signin_tracker.cc (revision 131686) |
+++ chrome/browser/signin/signin_tracker.cc (working copy) |
@@ -27,6 +27,24 @@ |
profile_(profile), |
observer_(observer), |
credentials_valid_(false) { |
+ Initialize(); |
+} |
+ |
+SigninTracker::SigninTracker(Profile* profile, |
+ Observer* observer, |
+ LoginState state) |
+ : state_(state), |
+ profile_(profile), |
+ observer_(observer), |
+ credentials_valid_(false) { |
+ Initialize(); |
+} |
+ |
+SigninTracker::~SigninTracker() { |
+ ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this); |
+} |
+ |
+void SigninTracker::Initialize() { |
DCHECK(observer_); |
// Register for notifications from the SigninManager. |
registrar_.Add(this, |
@@ -48,12 +66,9 @@ |
ProfileSyncService* service = |
ProfileSyncServiceFactory::GetForProfile(profile_); |
service->AddObserver(this); |
-} |
-SigninTracker::~SigninTracker() { |
- ProfileSyncService* service = |
- ProfileSyncServiceFactory::GetForProfile(profile_); |
- service->RemoveObserver(this); |
+ if (state_ == SERVICES_INITIALIZING) |
+ HandleServiceStateChange(); |
} |
void SigninTracker::Observe(int type, |
@@ -163,4 +178,3 @@ |
service->GetAuthError().state() == GoogleServiceAuthError::NONE && |
!service->unrecoverable_error_detected()); |
} |
- |