| 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 #import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller
.h" | 5 #import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller
.h" |
| 6 | 6 |
| 7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
| 8 #include "components/signin/core/browser/account_tracker_service.h" | 8 #include "components/signin/core/browser/account_tracker_service.h" |
| 9 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 9 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 10 #include "components/signin/ios/browser/oauth2_token_service_observer_bridge.h" | 10 #include "components/signin/ios/browser/oauth2_token_service_observer_bridge.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return YES; | 159 return YES; |
| 160 } | 160 } |
| 161 | 161 |
| 162 #pragma mark ChromeIdentityServiceObserver | 162 #pragma mark ChromeIdentityServiceObserver |
| 163 | 163 |
| 164 - (void)onProfileUpdate:(ChromeIdentity*)identity { | 164 - (void)onProfileUpdate:(ChromeIdentity*)identity { |
| 165 CollectionViewAccountItem* item = | 165 CollectionViewAccountItem* item = |
| 166 base::mac::ObjCCastStrict<CollectionViewAccountItem>( | 166 base::mac::ObjCCastStrict<CollectionViewAccountItem>( |
| 167 [_identityMap objectForKey:identity.gaiaID]); | 167 [_identityMap objectForKey:identity.gaiaID]); |
| 168 [self updateAccountItem:item withIdentity:identity]; | 168 [self updateAccountItem:item withIdentity:identity]; |
| 169 NSIndexPath* indexPath = | 169 NSIndexPath* indexPath = [self.collectionViewModel indexPathForItem:item]; |
| 170 [self.collectionViewModel indexPathForItem:item | |
| 171 inSectionWithIdentifier:SectionIdentifierAccounts]; | |
| 172 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; | 170 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; |
| 173 } | 171 } |
| 174 | 172 |
| 175 - (void)onChromeIdentityServiceWillBeDestroyed { | 173 - (void)onChromeIdentityServiceWillBeDestroyed { |
| 176 _identityServiceObserver.reset(); | 174 _identityServiceObserver.reset(); |
| 177 } | 175 } |
| 178 | 176 |
| 179 @end | 177 @end |
| 180 | 178 |
| 181 @interface SignedInAccountsViewController ()< | 179 @interface SignedInAccountsViewController ()< |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 OAuth2TokenServiceFactory::GetForBrowserState(_browserState); | 382 OAuth2TokenServiceFactory::GetForBrowserState(_browserState); |
| 385 if (tokenService->GetAccounts().empty()) { | 383 if (tokenService->GetAccounts().empty()) { |
| 386 [self dismiss]; | 384 [self dismiss]; |
| 387 return; | 385 return; |
| 388 } | 386 } |
| 389 [_accountsCollection loadModel]; | 387 [_accountsCollection loadModel]; |
| 390 [_accountsCollection.get().collectionView reloadData]; | 388 [_accountsCollection.get().collectionView reloadData]; |
| 391 } | 389 } |
| 392 | 390 |
| 393 @end | 391 @end |
| OLD | NEW |