OLD | NEW |
---|---|
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 state_ = WAITING_FOR_GAIA_VALIDATION; | 135 state_ = WAITING_FOR_GAIA_VALIDATION; |
136 observer_->SigninFailed( | 136 observer_->SigninFailed( |
137 GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); | 137 GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); |
138 return; | 138 return; |
139 } | 139 } |
140 | 140 |
141 // Wait until all of our services are logged in. For now this just means sync. | 141 // Wait until all of our services are logged in. For now this just means sync. |
142 // Long term, we should separate out service auth failures from the signin | 142 // Long term, we should separate out service auth failures from the signin |
143 // process, but for the current UI flow we'll validate service signin status | 143 // process, but for the current UI flow we'll validate service signin status |
144 // also. | 144 // also. |
145 ProfileSyncService* service = profile_->IsSyncAccessible() ? | 145 ProfileSyncService* service = |
146 ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; | 146 profile_->IsSyncAccessible() && profile_->IsSigninAllowed() ? |
Andrew T Wilson (Slow)
2013/02/04 15:41:48
No need to check IsSigninAllowed() here - leave it
Adrian Kuegel
2013/02/05 10:55:15
Done.
| |
147 ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; | |
147 if (service && service->waiting_for_auth()) { | 148 if (service && service->waiting_for_auth()) { |
148 // Still waiting for an auth token to come in so stay in the INITIALIZING | 149 // Still waiting for an auth token to come in so stay in the INITIALIZING |
149 // state (we do this to avoid triggering an early signin error in the case | 150 // state (we do this to avoid triggering an early signin error in the case |
150 // where there's a previous auth error in the sync service that hasn't | 151 // where there's a previous auth error in the sync service that hasn't |
151 // been cleared yet). | 152 // been cleared yet). |
152 return; | 153 return; |
153 } | 154 } |
154 | 155 |
155 // If we haven't loaded all our service tokens yet, just exit (we'll be called | 156 // If we haven't loaded all our service tokens yet, just exit (we'll be called |
156 // again when another token is loaded, or will transition to SigninFailed if | 157 // again when another token is loaded, or will transition to SigninFailed if |
(...skipping 29 matching lines...) Expand all Loading... | |
186 // Don't care about the sync state if sync is disabled by policy. | 187 // Don't care about the sync state if sync is disabled by policy. |
187 if (!profile->IsSyncAccessible()) | 188 if (!profile->IsSyncAccessible()) |
188 return true; | 189 return true; |
189 ProfileSyncService* service = | 190 ProfileSyncService* service = |
190 ProfileSyncServiceFactory::GetForProfile(profile); | 191 ProfileSyncServiceFactory::GetForProfile(profile); |
191 return (service->IsSyncEnabledAndLoggedIn() && | 192 return (service->IsSyncEnabledAndLoggedIn() && |
192 service->IsSyncTokenAvailable() && | 193 service->IsSyncTokenAvailable() && |
193 service->GetAuthError().state() == GoogleServiceAuthError::NONE && | 194 service->GetAuthError().state() == GoogleServiceAuthError::NONE && |
194 !service->HasUnrecoverableError()); | 195 !service->HasUnrecoverableError()); |
195 } | 196 } |
OLD | NEW |