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

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

Issue 23005016: [sync] Force re-auth during sync setup if Oauth2 token is unavailable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes to OAuth2TokenService and OneClickSigninHelper Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_oauth2_token_service.h" 5 #include "chrome/browser/signin/profile_oauth2_token_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 break; 145 break;
146 } 146 }
147 case chrome::NOTIFICATION_TOKENS_CLEARED: { 147 case chrome::NOTIFICATION_TOKENS_CLEARED: {
148 CancelAllRequests(); 148 CancelAllRequests();
149 ClearCache(); 149 ClearCache();
150 UpdateAuthError(GoogleServiceAuthError::AuthErrorNone()); 150 UpdateAuthError(GoogleServiceAuthError::AuthErrorNone());
151 FireRefreshTokensCleared(); 151 FireRefreshTokensCleared();
152 break; 152 break;
153 } 153 }
154 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: 154 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED:
155 // During startup, if the OAuth2 refresh token is empty, flag it as an
156 // error by badging the menu. Otherwise, if a signed in user tries to set
157 // up sync, they will have to make two attempts: One to surface the OAuth2
158 // error, and a second one after they've signed in. See crbug.com/276650.
159 if (GetRefreshToken().empty()) {
Andrew T Wilson (Slow) 2013/08/22 10:29:09 I think we probably only want to do this if the us
Raghu Simha 2013/08/22 17:48:50 From what I've seen, we enter this observer only w
160 UpdateAuthError(GoogleServiceAuthError(
161 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
162 }
155 FireRefreshTokensLoaded(); 163 FireRefreshTokensLoaded();
156 break; 164 break;
157 default: 165 default:
158 NOTREACHED() << "Invalid notification type=" << type; 166 NOTREACHED() << "Invalid notification type=" << type;
159 break; 167 break;
160 } 168 }
161 } 169 }
162 170
163 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const { 171 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const {
164 return last_auth_error_; 172 return last_auth_error_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 323 }
316 } 324 }
317 325
318 if (!old_login_token.empty() && 326 if (!old_login_token.empty() &&
319 refresh_tokens_.count(GetAccountId(profile_)) == 0) { 327 refresh_tokens_.count(GetAccountId(profile_)) == 0) {
320 UpdateCredentials(GetAccountId(profile_), old_login_token); 328 UpdateCredentials(GetAccountId(profile_), old_login_token);
321 } 329 }
322 330
323 FireRefreshTokensLoaded(); 331 FireRefreshTokensLoaded();
324 } 332 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698