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

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

Issue 12077030: Allow signin to continue even if sync is disabled by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows sync integration test failure Created 7 years, 11 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
« no previous file with comments | « chrome/browser/signin/signin_manager_fake.cc ('k') | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/signin_tracker.cc
diff --git a/chrome/browser/signin/signin_tracker.cc b/chrome/browser/signin/signin_tracker.cc
index 23baf29f2325855bf5407b19b4e9253c2eb11cd5..abc4fbe6fc6b5bbd316cef9f0d84ab3a24e53cfa 100644
--- a/chrome/browser/signin/signin_tracker.cc
+++ b/chrome/browser/signin/signin_tracker.cc
@@ -129,8 +129,8 @@ void SigninTracker::HandleServiceStateChange() {
return;
}
- if (SigninManagerFactory::GetForProfile(profile_)->
- GetAuthenticatedUsername().empty()) {
+ SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
+ if (signin->GetAuthenticatedUsername().empty()) {
// User is signed out, trigger a signin failure.
state_ = WAITING_FOR_GAIA_VALIDATION;
observer_->SigninFailed(
@@ -142,11 +142,9 @@ void SigninTracker::HandleServiceStateChange() {
// Long term, we should separate out service auth failures from the signin
// process, but for the current UI flow we'll validate service signin status
// also.
- // TODO(atwilson): Move the code to wait for app notification oauth tokens out
- // of ProfileSyncService and over to here (http://crbug.com/114209).
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetForProfile(profile_);
- if (service->waiting_for_auth()) {
+ ProfileSyncService* service = profile_->IsSyncAccessible() ?
+ ProfileSyncServiceFactory::GetForProfile(profile_) : NULL;
+ if (service && service->waiting_for_auth()) {
// Still waiting for an auth token to come in so stay in the INITIALIZING
// state (we do this to avoid triggering an early signin error in the case
// where there's a previous auth error in the sync service that hasn't
@@ -161,8 +159,8 @@ void SigninTracker::HandleServiceStateChange() {
return;
if (!AreServicesSignedIn(profile_)) {
state_ = WAITING_FOR_GAIA_VALIDATION;
- observer_->SigninFailed(service->GetAuthError());
- } else if (service->sync_initialized()) {
+ observer_->SigninFailed(signin->signin_global_error()->GetLastAuthError());
+ } else if (!service || service->sync_initialized()) {
state_ = SIGNIN_COMPLETE;
observer_->SigninSuccess();
}
@@ -185,6 +183,9 @@ bool SigninTracker::AreServiceTokensLoaded(Profile* profile) {
bool SigninTracker::AreServicesSignedIn(Profile* profile) {
if (!AreServiceTokensLoaded(profile))
return false;
+ // Don't care about the sync state if sync is disabled by policy.
+ if (!profile->IsSyncAccessible())
+ return true;
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile);
return (service->IsSyncEnabledAndLoggedIn() &&
« no previous file with comments | « chrome/browser/signin/signin_manager_fake.cc ('k') | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698