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

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

Issue 23759003: Revert 219146 "[sync] Force re-auth during sync setup if Oauth2 ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | trunk/src/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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 break; 148 break;
149 } 149 }
150 case chrome::NOTIFICATION_TOKENS_CLEARED: { 150 case chrome::NOTIFICATION_TOKENS_CLEARED: {
151 CancelAllRequests(); 151 CancelAllRequests();
152 ClearCache(); 152 ClearCache();
153 UpdateAuthError(GoogleServiceAuthError::AuthErrorNone()); 153 UpdateAuthError(GoogleServiceAuthError::AuthErrorNone());
154 FireRefreshTokensCleared(); 154 FireRefreshTokensCleared();
155 break; 155 break;
156 } 156 }
157 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: 157 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED:
158 // During startup, if the user is signed in and the OAuth2 refresh token
159 // is empty, flag it as an error by badging the menu. Otherwise, if the
160 // user goes on to set up sync, they will have to make two attempts:
161 // One to surface the OAuth2 error, and a second one after signing in.
162 // See crbug.com/276650.
163 if (!GetAccountId(profile_).empty() && GetRefreshToken().empty()) {
164 UpdateAuthError(GoogleServiceAuthError(
165 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
166 }
167 FireRefreshTokensLoaded(); 158 FireRefreshTokensLoaded();
168 break; 159 break;
169 default: 160 default:
170 NOTREACHED() << "Invalid notification type=" << type; 161 NOTREACHED() << "Invalid notification type=" << type;
171 break; 162 break;
172 } 163 }
173 } 164 }
174 165
175 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const { 166 GoogleServiceAuthError ProfileOAuth2TokenService::GetAuthStatus() const {
176 return last_auth_error_; 167 return last_auth_error_;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 314 }
324 } 315 }
325 316
326 if (!old_login_token.empty() && 317 if (!old_login_token.empty() &&
327 refresh_tokens_.count(GetAccountId(profile_)) == 0) { 318 refresh_tokens_.count(GetAccountId(profile_)) == 0) {
328 UpdateCredentials(GetAccountId(profile_), old_login_token); 319 UpdateCredentials(GetAccountId(profile_), old_login_token);
329 } 320 }
330 321
331 FireRefreshTokensLoaded(); 322 FireRefreshTokensLoaded();
332 } 323 }
OLDNEW
« no previous file with comments | « no previous file | trunk/src/chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698