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

Side by Side Diff: components/signin/ios/browser/profile_oauth2_token_service_ios.mm

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address roger's comments Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/signin/ios/browser/profile_oauth2_token_service_ios.h" 5 #include "components/signin/ios/browser/profile_oauth2_token_service_ios.h"
6 6
7 #include <Foundation/Foundation.h> 7 #include <Foundation/Foundation.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 303
304 OAuth2AccessTokenFetcher* 304 OAuth2AccessTokenFetcher*
305 ProfileOAuth2TokenServiceIOS::CreateAccessTokenFetcher( 305 ProfileOAuth2TokenServiceIOS::CreateAccessTokenFetcher(
306 const std::string& account_id, 306 const std::string& account_id,
307 net::URLRequestContextGetter* getter, 307 net::URLRequestContextGetter* getter,
308 OAuth2AccessTokenConsumer* consumer) { 308 OAuth2AccessTokenConsumer* consumer) {
309 return new SSOAccessTokenFetcher(consumer, GetProvider(), account_id); 309 return new SSOAccessTokenFetcher(consumer, GetProvider(), account_id);
310 } 310 }
311 311
312 void ProfileOAuth2TokenServiceIOS::InvalidateOAuth2Token( 312 void ProfileOAuth2TokenServiceIOS::InvalidateAccessToken(
313 const std::string& account_id, 313 const std::string& account_id,
314 const std::string& client_id, 314 const std::string& client_id,
315 const ScopeSet& scopes, 315 const ScopeSet& scopes,
316 const std::string& access_token) { 316 const std::string& access_token) {
317 DCHECK(thread_checker_.CalledOnValidThread()); 317 DCHECK(thread_checker_.CalledOnValidThread());
318 318
319 // Call |ProfileOAuth2TokenService::InvalidateOAuth2Token| to clear the 319 // Call |ProfileOAuth2TokenService::InvalidateAccessToken| to clear the
320 // cached access token. 320 // cached access token.
321 ProfileOAuth2TokenService::InvalidateOAuth2Token(account_id, 321 ProfileOAuth2TokenService::InvalidateAccessToken(account_id, client_id,
322 client_id, 322 scopes, access_token);
323 scopes,
324 access_token);
325 323
326 // There is no need to inform the authentication library that the access 324 // There is no need to inform the authentication library that the access
327 // token is invalid as it never caches the token. 325 // token is invalid as it never caches the token.
328 } 326 }
329 327
330 std::vector<std::string> ProfileOAuth2TokenServiceIOS::GetAccounts() { 328 std::vector<std::string> ProfileOAuth2TokenServiceIOS::GetAccounts() {
331 DCHECK(thread_checker_.CalledOnValidThread()); 329 DCHECK(thread_checker_.CalledOnValidThread());
332 std::vector<std::string> account_ids; 330 std::vector<std::string> account_ids;
333 for (auto i = accounts_.begin(); i != accounts_.end(); ++i) 331 for (auto i = accounts_.begin(); i != accounts_.end(); ++i)
334 account_ids.push_back(i->first); 332 account_ids.push_back(i->first);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 client()->GetPrefs()->SetBoolean( 488 client()->GetPrefs()->SetBoolean(
491 prefs::kTokenServiceExcludeAllSecondaryAccounts, true); 489 prefs::kTokenServiceExcludeAllSecondaryAccounts, true);
492 } 490 }
493 491
494 void ProfileOAuth2TokenServiceIOS::ClearExcludedSecondaryAccounts() { 492 void ProfileOAuth2TokenServiceIOS::ClearExcludedSecondaryAccounts() {
495 client()->GetPrefs()->ClearPref( 493 client()->GetPrefs()->ClearPref(
496 prefs::kTokenServiceExcludeAllSecondaryAccounts); 494 prefs::kTokenServiceExcludeAllSecondaryAccounts);
497 client()->GetPrefs()->ClearPref( 495 client()->GetPrefs()->ClearPref(
498 prefs::kTokenServiceExcludedSecondaryAccounts); 496 prefs::kTokenServiceExcludedSecondaryAccounts);
499 } 497 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698