| 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 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 (CollectionViewAccountItem*)identityAccountItem { | 888 (CollectionViewAccountItem*)identityAccountItem { |
| 889 AuthenticationService* authService = | 889 AuthenticationService* authService = |
| 890 AuthenticationServiceFactory::GetForBrowserState(_mainBrowserState); | 890 AuthenticationServiceFactory::GetForBrowserState(_mainBrowserState); |
| 891 _identity.reset([authService->GetAuthenticatedIdentity() retain]); | 891 _identity.reset([authService->GetAuthenticatedIdentity() retain]); |
| 892 if (!_identity) { | 892 if (!_identity) { |
| 893 // This could occur during the sign out process. Just ignore as the account | 893 // This could occur during the sign out process. Just ignore as the account |
| 894 // cell will be replaced by the "Sign in" button. | 894 // cell will be replaced by the "Sign in" button. |
| 895 return; | 895 return; |
| 896 } | 896 } |
| 897 identityAccountItem.image = [self userAccountImage]; | 897 identityAccountItem.image = [self userAccountImage]; |
| 898 identityAccountItem.text = [_identity userFullName]; |
| 898 | 899 |
| 899 SyncSetupService* syncSetupService = | 900 SyncSetupService* syncSetupService = |
| 900 SyncSetupServiceFactory::GetForBrowserState(_mainBrowserState); | 901 SyncSetupServiceFactory::GetForBrowserState(_mainBrowserState); |
| 901 | |
| 902 if (!syncSetupService->HasFinishedInitialSetup()) { | 902 if (!syncSetupService->HasFinishedInitialSetup()) { |
| 903 identityAccountItem.detailText = | 903 identityAccountItem.detailText = |
| 904 l10n_util::GetNSString(IDS_IOS_SYNC_SETUP_IN_PROGRESS); | 904 l10n_util::GetNSString(IDS_IOS_SYNC_SETUP_IN_PROGRESS); |
| 905 identityAccountItem.shouldDisplayError = NO; | 905 identityAccountItem.shouldDisplayError = NO; |
| 906 return; | 906 return; |
| 907 } | 907 } |
| 908 identityAccountItem.shouldDisplayError = | 908 identityAccountItem.shouldDisplayError = |
| 909 !ios_internal::sync::IsTransientSyncError( | 909 !ios_internal::sync::IsTransientSyncError( |
| 910 syncSetupService->GetSyncServiceState()); | 910 syncSetupService->GetSyncServiceState()); |
| 911 identityAccountItem.text = [_identity userFullName]; | |
| 912 if (identityAccountItem.shouldDisplayError) { | 911 if (identityAccountItem.shouldDisplayError) { |
| 913 identityAccountItem.detailText = | 912 identityAccountItem.detailText = |
| 914 ios_internal::sync::GetSyncErrorDescriptionForBrowserState( | 913 ios_internal::sync::GetSyncErrorDescriptionForBrowserState( |
| 915 _mainBrowserState); | 914 _mainBrowserState); |
| 916 } else { | 915 } else { |
| 917 identityAccountItem.detailText = | 916 identityAccountItem.detailText = |
| 918 syncSetupService->IsSyncEnabled() | 917 syncSetupService->IsSyncEnabled() |
| 919 ? l10n_util::GetNSStringF( | 918 ? l10n_util::GetNSStringF( |
| 920 IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNCING, | 919 IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNCING, |
| 921 base::SysNSStringToUTF16([_identity userEmail])) | 920 base::SysNSStringToUTF16([_identity userEmail])) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 NSString* autofillDetail = | 1079 NSString* autofillDetail = |
| 1081 autofillEnabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 1080 autofillEnabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
| 1082 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 1081 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
| 1083 _autoFillDetailItem.get().detailText = autofillDetail; | 1082 _autoFillDetailItem.get().detailText = autofillDetail; |
| 1084 [self reconfigureCellsForItems:@[ _autoFillDetailItem ] | 1083 [self reconfigureCellsForItems:@[ _autoFillDetailItem ] |
| 1085 inSectionWithIdentifier:SectionIdentifierBasics]; | 1084 inSectionWithIdentifier:SectionIdentifierBasics]; |
| 1086 } | 1085 } |
| 1087 } | 1086 } |
| 1088 | 1087 |
| 1089 @end | 1088 @end |
| OLD | NEW |