| 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/mac/objc_property_releaser.h" | 8 #include "base/mac/objc_property_releaser.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "components/bookmarks/browser/bookmark_model.h" | 10 #include "components/bookmarks/browser/bookmark_model.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 - (void)collectionViewScrolled { | 432 - (void)collectionViewScrolled { |
| 433 [self.delegate bookmarkCollectionViewDidScroll:self]; | 433 [self.delegate bookmarkCollectionViewDidScroll:self]; |
| 434 } | 434 } |
| 435 | 435 |
| 436 - (void)setEditing:(BOOL)editing animated:(BOOL)animated { | 436 - (void)setEditing:(BOOL)editing animated:(BOOL)animated { |
| 437 [super setEditing:editing animated:animated]; | 437 [super setEditing:editing animated:animated]; |
| 438 [self promoStateChangedAnimated:animated]; | 438 [self promoStateChangedAnimated:animated]; |
| 439 } | 439 } |
| 440 | 440 |
| 441 - (void)promoStateChangedAnimated:(BOOL)animate { | 441 - (void)promoStateChangedAnimated:(BOOL)animate { |
| 442 if (experimental_flags::IsAllBookmarksEnabled()) |
| 443 return; // The promo is not shown if All Bookmarks is enabled. |
| 444 |
| 442 BOOL newPromoState = | 445 BOOL newPromoState = |
| 443 !self.editing && self.folder && | 446 !self.editing && self.folder && |
| 444 self.folder->type() == BookmarkNode::MOBILE && | 447 self.folder->type() == BookmarkNode::MOBILE && |
| 445 [self.delegate bookmarkCollectionViewShouldShowPromoCell:self]; | 448 [self.delegate bookmarkCollectionViewShouldShowPromoCell:self]; |
| 446 if (newPromoState != _promoVisible) { | 449 if (newPromoState != _promoVisible) { |
| 447 // This is awful, but until the old code to do the refresh when switching | 450 // This is awful, but until the old code to do the refresh when switching |
| 448 // in and out of edit mode is fixed, this is probably the cleanest thing to | 451 // in and out of edit mode is fixed, this is probably the cleanest thing to |
| 449 // do. | 452 // do. |
| 450 _promoVisible = newPromoState; | 453 _promoVisible = newPromoState; |
| 451 [self.collectionView reloadData]; | 454 [self.collectionView reloadData]; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 462 [self.delegate bookmarkCollectionViewDismissPromo:self]; | 465 [self.delegate bookmarkCollectionViewDismissPromo:self]; |
| 463 } | 466 } |
| 464 | 467 |
| 465 #pragma mark - Promo Cell | 468 #pragma mark - Promo Cell |
| 466 | 469 |
| 467 - (BOOL)shouldShowPromoCell { | 470 - (BOOL)shouldShowPromoCell { |
| 468 return _promoVisible; | 471 return _promoVisible; |
| 469 } | 472 } |
| 470 | 473 |
| 471 @end | 474 @end |
| OLD | NEW |