| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_delegat
e.h" | 5 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat
e.h" |
| 6 | 6 |
| 7 #include <Foundation/Foundation.h> | 7 #include <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return account_id_; | 170 return account_id_; |
| 171 } | 171 } |
| 172 | 172 |
| 173 GoogleServiceAuthError | 173 GoogleServiceAuthError |
| 174 ProfileOAuth2TokenServiceIOSDelegate::AccountStatus::GetAuthStatus() const { | 174 ProfileOAuth2TokenServiceIOSDelegate::AccountStatus::GetAuthStatus() const { |
| 175 return last_auth_error_; | 175 return last_auth_error_; |
| 176 } | 176 } |
| 177 | 177 |
| 178 ProfileOAuth2TokenServiceIOSDelegate::ProfileOAuth2TokenServiceIOSDelegate( | 178 ProfileOAuth2TokenServiceIOSDelegate::ProfileOAuth2TokenServiceIOSDelegate( |
| 179 SigninClient* client, | 179 SigninClient* client, |
| 180 ProfileOAuth2TokenServiceIOSProvider* provider, | 180 std::unique_ptr<ProfileOAuth2TokenServiceIOSProvider> provider, |
| 181 AccountTrackerService* account_tracker_service, | 181 AccountTrackerService* account_tracker_service, |
| 182 SigninErrorController* signin_error_controller) | 182 SigninErrorController* signin_error_controller) |
| 183 : client_(client), | 183 : client_(client), |
| 184 provider_(provider), | 184 provider_(std::move(provider)), |
| 185 account_tracker_service_(account_tracker_service), | 185 account_tracker_service_(account_tracker_service), |
| 186 signin_error_controller_(signin_error_controller) { | 186 signin_error_controller_(signin_error_controller) { |
| 187 DCHECK(client_); | 187 DCHECK(client_); |
| 188 DCHECK(provider_); | 188 DCHECK(provider_); |
| 189 DCHECK(account_tracker_service_); | 189 DCHECK(account_tracker_service_); |
| 190 DCHECK(signin_error_controller_); | 190 DCHECK(signin_error_controller_); |
| 191 } | 191 } |
| 192 | 192 |
| 193 ProfileOAuth2TokenServiceIOSDelegate::~ProfileOAuth2TokenServiceIOSDelegate() { | 193 ProfileOAuth2TokenServiceIOSDelegate::~ProfileOAuth2TokenServiceIOSDelegate() { |
| 194 DCHECK(thread_checker_.CalledOnValidThread()); | 194 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 ClearExcludedSecondaryAccounts(); | 295 ClearExcludedSecondaryAccounts(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 OAuth2AccessTokenFetcher* | 298 OAuth2AccessTokenFetcher* |
| 299 ProfileOAuth2TokenServiceIOSDelegate::CreateAccessTokenFetcher( | 299 ProfileOAuth2TokenServiceIOSDelegate::CreateAccessTokenFetcher( |
| 300 const std::string& account_id, | 300 const std::string& account_id, |
| 301 net::URLRequestContextGetter* getter, | 301 net::URLRequestContextGetter* getter, |
| 302 OAuth2AccessTokenConsumer* consumer) { | 302 OAuth2AccessTokenConsumer* consumer) { |
| 303 AccountInfo account_info = | 303 AccountInfo account_info = |
| 304 account_tracker_service_->GetAccountInfo(account_id); | 304 account_tracker_service_->GetAccountInfo(account_id); |
| 305 return new SSOAccessTokenFetcher(consumer, provider_, account_info); | 305 return new SSOAccessTokenFetcher(consumer, provider_.get(), account_info); |
| 306 } | 306 } |
| 307 | 307 |
| 308 std::vector<std::string> ProfileOAuth2TokenServiceIOSDelegate::GetAccounts() { | 308 std::vector<std::string> ProfileOAuth2TokenServiceIOSDelegate::GetAccounts() { |
| 309 DCHECK(thread_checker_.CalledOnValidThread()); | 309 DCHECK(thread_checker_.CalledOnValidThread()); |
| 310 std::vector<std::string> account_ids; | 310 std::vector<std::string> account_ids; |
| 311 for (auto i = accounts_.begin(); i != accounts_.end(); ++i) | 311 for (auto i = accounts_.begin(); i != accounts_.end(); ++i) |
| 312 account_ids.push_back(i->first); | 312 account_ids.push_back(i->first); |
| 313 return account_ids; | 313 return account_ids; |
| 314 } | 314 } |
| 315 | 315 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 accounts_.erase(account_id); | 385 accounts_.erase(account_id); |
| 386 FireRefreshTokenRevoked(account_id); | 386 FireRefreshTokenRevoked(account_id); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() { | 390 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() { |
| 391 client_->GetPrefs()->ClearPref( | 391 client_->GetPrefs()->ClearPref( |
| 392 prefs::kTokenServiceExcludeAllSecondaryAccounts); | 392 prefs::kTokenServiceExcludeAllSecondaryAccounts); |
| 393 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts); | 393 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts); |
| 394 } | 394 } |
| OLD | NEW |