Index: chrome/browser/signin/signin_tracker.cc |
diff --git a/chrome/browser/signin/signin_tracker.cc b/chrome/browser/signin/signin_tracker.cc |
index ec2e02334dc1a553618565f005b94a77f6d7beaa..0d743ee487b9b7644041145c0db5d4afdb97d89f 100644 |
--- a/chrome/browser/signin/signin_tracker.cc |
+++ b/chrome/browser/signin/signin_tracker.cc |
@@ -27,6 +27,26 @@ SigninTracker::SigninTracker(Profile* profile, Observer* observer) |
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() { |
+ ProfileSyncService* service = |
arv (Not doing code reviews)
2012/04/04 17:04:21
No need for var here
kochi
2012/04/04 17:29:46
Done.
|
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
+ service->RemoveObserver(this); |
+} |
+ |
+void SigninTracker::Initialize() { |
DCHECK(observer_); |
// Register for notifications from the SigninManager. |
registrar_.Add(this, |
@@ -48,12 +68,9 @@ SigninTracker::SigninTracker(Profile* profile, Observer* observer) |
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 +180,3 @@ bool SigninTracker::AreServicesSignedIn(Profile* profile) { |
service->GetAuthError().state() == GoogleServiceAuthError::NONE && |
!service->unrecoverable_error_detected()); |
} |
- |