Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6260)

Unified Diff: chrome/browser/signin/signin_tracker.cc

Issue 9956097: suppress user/password dialog when re-enabling sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More OS_CHROMEOS guard for compilation. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}
-

Powered by Google App Engine
This is Rietveld 408576698