OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/signin/profile_oauth2_token_service_ios_provider_im
pl.h" | 5 #include "ios/chrome/browser/signin/profile_oauth2_token_service_ios_provider_im
pl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "ios/chrome/browser/signin/constants.h" | 9 #include "ios/chrome/browser/signin/constants.h" |
10 #include "ios/chrome/browser/signin/signin_util.h" | 10 #include "ios/chrome/browser/signin/signin_util.h" |
11 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 11 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
12 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" | 12 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" |
13 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 13 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
14 #include "ios/public/provider/chrome/browser/signin/signin_error_provider.h" | 14 #include "ios/public/provider/chrome/browser/signin/signin_error_provider.h" |
15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
16 namespace { | 20 namespace { |
17 // Returns the account info for |identity|. | 21 // Returns the account info for |identity|. |
18 // Returns an empty account info if |identity| is nil. | 22 // Returns an empty account info if |identity| is nil. |
19 ProfileOAuth2TokenServiceIOSProvider::AccountInfo GetAccountInfo( | 23 ProfileOAuth2TokenServiceIOSProvider::AccountInfo GetAccountInfo( |
20 ChromeIdentity* identity) { | 24 ChromeIdentity* identity) { |
21 ProfileOAuth2TokenServiceIOSProvider::AccountInfo account_info; | 25 ProfileOAuth2TokenServiceIOSProvider::AccountInfo account_info; |
22 if (identity) { | 26 if (identity) { |
23 account_info.gaia = base::SysNSStringToUTF8([identity gaiaID]); | 27 account_info.gaia = base::SysNSStringToUTF8([identity gaiaID]); |
24 account_info.email = GetCanonicalizedEmailForIdentity(identity); | 28 account_info.email = GetCanonicalizedEmailForIdentity(identity); |
25 } | 29 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (provider->IsForbidden(error)) { | 103 if (provider->IsForbidden(error)) { |
100 return kAuthenticationErrorCategoryAuthorizationForbiddenErrors; | 104 return kAuthenticationErrorCategoryAuthorizationForbiddenErrors; |
101 } | 105 } |
102 return kAuthenticationErrorCategoryAuthorizationErrors; | 106 return kAuthenticationErrorCategoryAuthorizationErrors; |
103 case ios::SigninErrorCategory::NETWORK_ERROR: | 107 case ios::SigninErrorCategory::NETWORK_ERROR: |
104 return kAuthenticationErrorCategoryNetworkServerErrors; | 108 return kAuthenticationErrorCategoryNetworkServerErrors; |
105 case ios::SigninErrorCategory::USER_CANCELLATION_ERROR: | 109 case ios::SigninErrorCategory::USER_CANCELLATION_ERROR: |
106 return kAuthenticationErrorCategoryUserCancellationErrors; | 110 return kAuthenticationErrorCategoryUserCancellationErrors; |
107 } | 111 } |
108 } | 112 } |
OLD | NEW |