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

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

Issue 138243004: Gracefully handle being signed out of a supervised profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/mutable_profile_oauth2_token_service.h" 5 #include "chrome/browser/signin/mutable_profile_oauth2_token_service.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/webdata/web_data_service_factory.h" 8 #include "chrome/browser/webdata/web_data_service_factory.h"
9 #include "components/signin/core/webdata/token_web_data.h" 9 #include "components/signin/core/webdata/token_web_data.h"
10 #include "components/webdata/common/web_data_service_base.h" 10 #include "components/webdata/common/web_data_service_base.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 #if defined(OS_IOS) 242 #if defined(OS_IOS)
243 // ProfileOauth2TokenService does not manage the refresh tokens on iOS - the 243 // ProfileOauth2TokenService does not manage the refresh tokens on iOS - the
244 // account info on iOS is only used to manage the authentication error state. 244 // account info on iOS is only used to manage the authentication error state.
245 // Simply add an account info entry with empty refresh token if none exists. 245 // Simply add an account info entry with empty refresh token if none exists.
246 if (refresh_tokens_.count(account_id) == 0) { 246 if (refresh_tokens_.count(account_id) == 0) {
247 refresh_tokens_[account_id].reset( 247 refresh_tokens_[account_id].reset(
248 new AccountInfo(this, account_id, std::string())); 248 new AccountInfo(this, account_id, std::string()));
249 } 249 }
250 #endif 250 #endif
251 251
252 DCHECK_GT(refresh_tokens_.count(account_id), 0u); 252 if (refresh_tokens_.count(account_id) == 0) {
253 // This could happen if the preferences have been corrupted (see
254 // http://crbug.com/321370). In a Debug build that would be a bug, but in a
255 // Release build we want to deal with it gracefully.
256 NOTREACHED();
257 return;
258 }
253 refresh_tokens_[account_id]->SetLastAuthError(error); 259 refresh_tokens_[account_id]->SetLastAuthError(error);
254 } 260 }
255 261
256 std::vector<std::string> MutableProfileOAuth2TokenService::GetAccounts() { 262 std::vector<std::string> MutableProfileOAuth2TokenService::GetAccounts() {
257 std::vector<std::string> account_ids; 263 std::vector<std::string> account_ids;
258 for (AccountInfoMap::const_iterator iter = refresh_tokens_.begin(); 264 for (AccountInfoMap::const_iterator iter = refresh_tokens_.begin();
259 iter != refresh_tokens_.end(); ++iter) { 265 iter != refresh_tokens_.end(); ++iter) {
260 account_ids.push_back(iter->first); 266 account_ids.push_back(iter->first);
261 } 267 }
262 return account_ids; 268 return account_ids;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 #endif 360 #endif
355 361
356 return GetPrimaryAccountId(); 362 return GetPrimaryAccountId();
357 } 363 }
358 364
359 void MutableProfileOAuth2TokenService::RevokeCredentialsOnServer( 365 void MutableProfileOAuth2TokenService::RevokeCredentialsOnServer(
360 const std::string& refresh_token) { 366 const std::string& refresh_token) {
361 // RevokeServerRefreshToken deletes itself when done. 367 // RevokeServerRefreshToken deletes itself when done.
362 new RevokeServerRefreshToken(refresh_token, GetRequestContext()); 368 new RevokeServerRefreshToken(refresh_token, GetRequestContext());
363 } 369 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698