| 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/accounts_collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/accounts_collection_view_controller.h" |
| 6 | 6 |
| 7 #import "base/ios/weak_nsobject.h" | 7 #import "base/ios/weak_nsobject.h" |
| 8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 - (void)loadModel { | 181 - (void)loadModel { |
| 182 // Update the title with the name with the currently signed-in account. | 182 // Update the title with the name with the currently signed-in account. |
| 183 ChromeIdentity* authenticatedIdentity = | 183 ChromeIdentity* authenticatedIdentity = |
| 184 [self authService]->GetAuthenticatedIdentity(); | 184 [self authService]->GetAuthenticatedIdentity(); |
| 185 NSString* title = nil; | 185 NSString* title = nil; |
| 186 if (authenticatedIdentity) { | 186 if (authenticatedIdentity) { |
| 187 title = [authenticatedIdentity userFullName]; | 187 title = [authenticatedIdentity userFullName]; |
| 188 if (!title) { | 188 if (!title) { |
| 189 // TODO(crbug.com/656994): Figure how to handle unnamed account. | 189 title = [authenticatedIdentity userEmail]; |
| 190 title = @"Unnamed account"; | |
| 191 } | 190 } |
| 192 } | 191 } |
| 193 self.title = title; | 192 self.title = title; |
| 194 | 193 |
| 195 [super loadModel]; | 194 [super loadModel]; |
| 196 | 195 |
| 197 if (![self authService]->IsAuthenticated()) | 196 if (![self authService]->IsAuthenticated()) |
| 198 return; | 197 return; |
| 199 | 198 |
| 200 CollectionViewModel* model = self.collectionViewModel; | 199 CollectionViewModel* model = self.collectionViewModel; |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 [self.collectionViewModel indexPathForItem:item | 667 [self.collectionViewModel indexPathForItem:item |
| 669 inSectionWithIdentifier:SectionIdentifierAccounts]; | 668 inSectionWithIdentifier:SectionIdentifierAccounts]; |
| 670 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; | 669 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; |
| 671 } | 670 } |
| 672 | 671 |
| 673 - (void)onChromeIdentityServiceWillBeDestroyed { | 672 - (void)onChromeIdentityServiceWillBeDestroyed { |
| 674 _identityServiceObserver.reset(); | 673 _identityServiceObserver.reset(); |
| 675 } | 674 } |
| 676 | 675 |
| 677 @end | 676 @end |
| OLD | NEW |