| 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/ui/authentication/signin_account_selector_view_cont
roller.h" | 5 #include "ios/chrome/browser/ui/authentication/signin_account_selector_view_cont
roller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } else if (item.type == ItemTypeAddAccount) { | 249 } else if (item.type == ItemTypeAddAccount) { |
| 250 [self.delegate accountSelectorControllerDidSelectAddAccount:self]; | 250 [self.delegate accountSelectorControllerDidSelectAddAccount:self]; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 #pragma mark - ChromeIdentityServiceObserver | 254 #pragma mark - ChromeIdentityServiceObserver |
| 255 | 255 |
| 256 - (void)onIdentityListChanged { | 256 - (void)onIdentityListChanged { |
| 257 ChromeIdentity* selectedIdentity = [self selectedIdentity]; | 257 ChromeIdentity* selectedIdentity = [self selectedIdentity]; |
| 258 [self loadModel]; | 258 [self loadModel]; |
| 259 [self.collectionView reloadData]; |
| 259 | 260 |
| 260 // Reselect the identity. | 261 // Reselect the identity. |
| 261 if (!selectedIdentity) { | 262 if (!selectedIdentity) { |
| 262 return; | 263 return; |
| 263 } | 264 } |
| 264 NSArray* accountItems = [self.collectionViewModel | 265 NSArray* accountItems = [self.collectionViewModel |
| 265 itemsInSectionWithIdentifier:SectionIdentifierAccounts]; | 266 itemsInSectionWithIdentifier:SectionIdentifierAccounts]; |
| 266 for (CollectionViewAccountItem* accountItem in accountItems) { | 267 for (CollectionViewAccountItem* accountItem in accountItems) { |
| 267 if ([accountItem.chromeIdentity.gaiaID | 268 if ([accountItem.chromeIdentity.gaiaID |
| 268 isEqualToString:selectedIdentity.gaiaID]) { | 269 isEqualToString:selectedIdentity.gaiaID]) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 324 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 324 return (itemType == ItemTypeTitle); | 325 return (itemType == ItemTypeTitle); |
| 325 } | 326 } |
| 326 | 327 |
| 327 - (BOOL)collectionView:(nonnull UICollectionView*)collectionView | 328 - (BOOL)collectionView:(nonnull UICollectionView*)collectionView |
| 328 shouldHideItemBackgroundAtIndexPath:(nonnull NSIndexPath*)indexPath { | 329 shouldHideItemBackgroundAtIndexPath:(nonnull NSIndexPath*)indexPath { |
| 329 return YES; | 330 return YES; |
| 330 } | 331 } |
| 331 | 332 |
| 332 @end | 333 @end |
| OLD | NEW |