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

Side by Side Diff: chrome/browser/signin/signin_tracker.cc

Issue 14655009: Client changes for disabled dasher account (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 7 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/signin/signin_tracker.h" 5 #include "chrome/browser/signin/signin_tracker.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/signin_manager.h" 8 #include "chrome/browser/signin/signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/signin/token_service.h" 10 #include "chrome/browser/signin/token_service.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // static 165 // static
166 bool SigninTracker::AreServicesSignedIn(Profile* profile) { 166 bool SigninTracker::AreServicesSignedIn(Profile* profile) {
167 if (!AreServiceTokensLoaded(profile)) 167 if (!AreServiceTokensLoaded(profile))
168 return false; 168 return false;
169 // Don't care about the sync state if sync is disabled by policy. 169 // Don't care about the sync state if sync is disabled by policy.
170 if (!profile->IsSyncAccessible()) 170 if (!profile->IsSyncAccessible())
171 return true; 171 return true;
172 ProfileSyncService* service = 172 ProfileSyncService* service =
173 ProfileSyncServiceFactory::GetForProfile(profile); 173 ProfileSyncServiceFactory::GetForProfile(profile);
174 // Check if sync disabled for domain flag was received from server. Don't care
175 // about the sync state in this case.
176 if (service->IsManaged())
Andrew T Wilson (Slow) 2013/05/24 15:13:10 Rather than making every caller of Profile::IsSync
pavely 2013/05/24 22:17:11 I tried this in my experiments. The issue is that
Andrew T Wilson (Slow) 2013/05/27 15:03:34 Yeah, that's a funky edge case. You could deal wit
177 return true;
174 return (service->IsSyncEnabledAndLoggedIn() && 178 return (service->IsSyncEnabledAndLoggedIn() &&
175 service->IsSyncTokenAvailable() && 179 service->IsSyncTokenAvailable() &&
176 service->GetAuthError().state() == GoogleServiceAuthError::NONE && 180 service->GetAuthError().state() == GoogleServiceAuthError::NONE &&
177 !service->HasUnrecoverableError()); 181 !service->HasUnrecoverableError());
178 } 182 }
179 183
180 // static 184 // static
181 SigninTracker::LoginState SigninTracker::GetSigninState( 185 SigninTracker::LoginState SigninTracker::GetSigninState(
182 Profile* profile, 186 Profile* profile,
183 GoogleServiceAuthError* error) { 187 GoogleServiceAuthError* error) {
184 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); 188 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
185 if (signin->GetAuthenticatedUsername().empty()) { 189 if (signin->GetAuthenticatedUsername().empty()) {
186 // User is signed out, trigger a signin failure. 190 // User is signed out, trigger a signin failure.
187 if (error) 191 if (error)
188 *error = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED); 192 *error = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
189 return WAITING_FOR_GAIA_VALIDATION; 193 return WAITING_FOR_GAIA_VALIDATION;
190 } 194 }
191 195
192 // Wait until all of our services are logged in. For now this just means sync. 196 // Wait until all of our services are logged in. For now this just means sync.
193 // Long term, we should separate out service auth failures from the signin 197 // Long term, we should separate out service auth failures from the signin
194 // process, but for the current UI flow we'll validate service signin status 198 // process, but for the current UI flow we'll validate service signin status
195 // also. 199 // also.
196 ProfileSyncService* service = profile->IsSyncAccessible() ? 200 ProfileSyncService* service = profile->IsSyncAccessible() ?
197 ProfileSyncServiceFactory::GetForProfile(profile) : NULL; 201 ProfileSyncServiceFactory::GetForProfile(profile) : NULL;
202 if (service->IsManaged())
Andrew T Wilson (Slow) 2013/05/24 15:13:10 See my previous comment - if IsSyncAccessible() ca
203 service = NULL;
198 if (service && service->waiting_for_auth()) { 204 if (service && service->waiting_for_auth()) {
199 // Still waiting for an auth token to come in so stay in the INITIALIZING 205 // Still waiting for an auth token to come in so stay in the INITIALIZING
200 // state (we do this to avoid triggering an early signin error in the case 206 // state (we do this to avoid triggering an early signin error in the case
201 // where there's a previous auth error in the sync service that hasn't 207 // where there's a previous auth error in the sync service that hasn't
202 // been cleared yet). 208 // been cleared yet).
203 return SERVICES_INITIALIZING; 209 return SERVICES_INITIALIZING;
204 } 210 }
205 211
206 // If we haven't loaded all our service tokens yet, just exit (we'll be called 212 // If we haven't loaded all our service tokens yet, just exit (we'll be called
207 // again when another token is loaded, or will transition to SigninFailed if 213 // again when another token is loaded, or will transition to SigninFailed if
208 // the loading fails). 214 // the loading fails).
209 if (!AreServiceTokensLoaded(profile)) 215 if (!AreServiceTokensLoaded(profile))
210 return SERVICES_INITIALIZING; 216 return SERVICES_INITIALIZING;
211 if (!AreServicesSignedIn(profile)) { 217 if (!AreServicesSignedIn(profile)) {
212 if (error) 218 if (error)
213 *error = signin->signin_global_error()->GetLastAuthError(); 219 *error = signin->signin_global_error()->GetLastAuthError();
214 return WAITING_FOR_GAIA_VALIDATION; 220 return WAITING_FOR_GAIA_VALIDATION;
215 } 221 }
216 222
217 if (!service || service->sync_initialized()) 223 if (!service || service->sync_initialized())
218 return SIGNIN_COMPLETE; 224 return SIGNIN_COMPLETE;
219 225
220 return SERVICES_INITIALIZING; 226 return SERVICES_INITIALIZING;
221 } 227 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service.h » ('j') | chrome/browser/sync/profile_sync_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698