OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 case ios::kAuthenticationErrorCategoryUnknownIdentityErrors: | 54 case ios::kAuthenticationErrorCategoryUnknownIdentityErrors: |
55 return GoogleServiceAuthError(GoogleServiceAuthError::USER_NOT_SIGNED_UP); | 55 return GoogleServiceAuthError(GoogleServiceAuthError::USER_NOT_SIGNED_UP); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 class SSOAccessTokenFetcher : public OAuth2AccessTokenFetcher { | 59 class SSOAccessTokenFetcher : public OAuth2AccessTokenFetcher { |
60 public: | 60 public: |
61 SSOAccessTokenFetcher(OAuth2AccessTokenConsumer* consumer, | 61 SSOAccessTokenFetcher(OAuth2AccessTokenConsumer* consumer, |
62 ios::ProfileOAuth2TokenServiceIOSProvider* provider, | 62 ios::ProfileOAuth2TokenServiceIOSProvider* provider, |
63 const std::string account_id); | 63 const std::string account_id); |
64 virtual ~SSOAccessTokenFetcher(); | 64 ~SSOAccessTokenFetcher() override; |
65 | 65 |
66 virtual void Start(const std::string& client_id, | 66 void Start(const std::string& client_id, |
67 const std::string& client_secret, | 67 const std::string& client_secret, |
68 const std::vector<std::string>& scopes) override; | 68 const std::vector<std::string>& scopes) override; |
69 | 69 |
70 virtual void CancelRequest() override; | 70 void CancelRequest() override; |
71 | 71 |
72 // Handles an access token response. | 72 // Handles an access token response. |
73 void OnAccessTokenResponse(NSString* token, | 73 void OnAccessTokenResponse(NSString* token, |
74 NSDate* expiration, | 74 NSDate* expiration, |
75 NSError* error); | 75 NSError* error); |
76 | 76 |
77 private: | 77 private: |
78 ios::ProfileOAuth2TokenServiceIOSProvider* provider_; // weak | 78 ios::ProfileOAuth2TokenServiceIOSProvider* provider_; // weak |
79 std::string account_id_; | 79 std::string account_id_; |
80 bool request_was_cancelled_; | 80 bool request_was_cancelled_; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 DCHECK(thread_checker_.CalledOnValidThread()); | 345 DCHECK(thread_checker_.CalledOnValidThread()); |
346 DCHECK(!account_id.empty()); | 346 DCHECK(!account_id.empty()); |
347 | 347 |
348 if (accounts_.count(account_id) > 0) { | 348 if (accounts_.count(account_id) > 0) { |
349 CancelRequestsForAccount(account_id); | 349 CancelRequestsForAccount(account_id); |
350 ClearCacheForAccount(account_id); | 350 ClearCacheForAccount(account_id); |
351 accounts_.erase(account_id); | 351 accounts_.erase(account_id); |
352 FireRefreshTokenRevoked(account_id); | 352 FireRefreshTokenRevoked(account_id); |
353 } | 353 } |
354 } | 354 } |
OLD | NEW |