OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bookmarks/bookmark_folder_collection_view.h" | 5 #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_collection_view.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 "components/bookmarks/browser/bookmark_model.h" | 9 #include "components/bookmarks/browser/bookmark_model.h" |
10 #include "ios/chrome/browser/bookmarks/bookmarks_utils.h" | 10 #include "ios/chrome/browser/bookmarks/bookmarks_utils.h" |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 - (BOOL)shouldShowPromoCell { | 538 - (BOOL)shouldShowPromoCell { |
539 return _promoVisible; | 539 return _promoVisible; |
540 } | 540 } |
541 | 541 |
542 #pragma mark - SigninPromoViewConsumer | 542 #pragma mark - SigninPromoViewConsumer |
543 | 543 |
544 - (void)configureSigninPromoViewWithNewIdentity:(BOOL)newIdentity | 544 - (void)configureSigninPromoViewWithNewIdentity:(BOOL)newIdentity |
545 configurator:(SigninPromoViewConfigurator*) | 545 configurator:(SigninPromoViewConfigurator*) |
546 configurator { | 546 configurator { |
547 DCHECK(_signinPromoViewMediator); | 547 DCHECK(_signinPromoViewMediator); |
548 if (newIdentity) { | |
549 NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:self.promoSection]; | |
550 [self.collectionView reloadSections:indexSet]; | |
551 return; | |
552 } | |
553 NSIndexPath* indexPath = | 548 NSIndexPath* indexPath = |
554 [NSIndexPath indexPathForRow:0 inSection:self.promoSection]; | 549 [NSIndexPath indexPathForRow:0 inSection:self.promoSection]; |
555 BookmarkSigninPromoCell* signinPromoCell = | 550 BookmarkSigninPromoCell* signinPromoCell = |
556 static_cast<BookmarkSigninPromoCell*>( | 551 static_cast<BookmarkSigninPromoCell*>( |
557 [self.collectionView cellForItemAtIndexPath:indexPath]); | 552 [self.collectionView cellForItemAtIndexPath:indexPath]); |
558 if (!signinPromoCell) | 553 if (!signinPromoCell) |
559 return; | 554 return; |
555 // Should always reconfigure the cell size even if it has to be reloaded. | |
556 // -[BookmarkFolderCollectionView cellSizeForIndexPath:] uses the current | |
lpromero
2017/05/23 09:27:18
The electrical current? The river's current? :)
jlebel
2017/05/23 12:24:07
All currents!
| |
557 // to compute its height. | |
560 [configurator configureSigninPromoView:signinPromoCell.signinPromoView]; | 558 [configurator configureSigninPromoView:signinPromoCell.signinPromoView]; |
559 if (newIdentity) { | |
560 // The section should be reload to update the cell height. | |
561 NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:self.promoSection]; | |
562 [self.collectionView reloadSections:indexSet]; | |
563 } | |
561 } | 564 } |
562 | 565 |
563 @end | 566 @end |
OLD | NEW |