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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 - (UICollectionViewCell*)cellAtIndexPath:(NSIndexPath*)indexPath { | 407 - (UICollectionViewCell*)cellAtIndexPath:(NSIndexPath*)indexPath { |
408 if (indexPath.section == self.promoSection) { | 408 if (indexPath.section == self.promoSection) { |
409 if (experimental_flags::IsSigninPromoEnabled()) { | 409 if (experimental_flags::IsSigninPromoEnabled()) { |
410 BookmarkSigninPromoCell* signinPromoCell = [self.collectionView | 410 BookmarkSigninPromoCell* signinPromoCell = [self.collectionView |
411 dequeueReusableCellWithReuseIdentifier:[BookmarkSigninPromoCell | 411 dequeueReusableCellWithReuseIdentifier:[BookmarkSigninPromoCell |
412 reuseIdentifier] | 412 reuseIdentifier] |
413 forIndexPath:indexPath]; | 413 forIndexPath:indexPath]; |
414 signinPromoCell.signinPromoView.sendChromeCommand = YES; | 414 signinPromoCell.signinPromoView.sendChromeCommand = YES; |
415 [[_signinPromoViewMediator createConfigurator] | 415 [[_signinPromoViewMediator createConfigurator] |
416 configureSigninPromoView:signinPromoCell.signinPromoView]; | 416 configureSigninPromoView:signinPromoCell.signinPromoView]; |
417 [signinPromoCell.signinPromoView.dismissButton | |
418 addTarget:self | |
lpromero
2017/05/02 16:46:04
I don't think it's an issue in your case, but conc
jlebel
2017/05/03 12:41:14
Done.
| |
419 action:@selector(dismissSigninPromo:) | |
420 forControlEvents:UIControlEventTouchUpInside]; | |
417 return signinPromoCell; | 421 return signinPromoCell; |
418 } else { | 422 } else { |
419 BookmarkPromoCell* promoCell = [self.collectionView | 423 BookmarkPromoCell* promoCell = [self.collectionView |
420 dequeueReusableCellWithReuseIdentifier:[BookmarkPromoCell | 424 dequeueReusableCellWithReuseIdentifier:[BookmarkPromoCell |
421 reuseIdentifier] | 425 reuseIdentifier] |
422 forIndexPath:indexPath]; | 426 forIndexPath:indexPath]; |
423 promoCell.delegate = self; | 427 promoCell.delegate = self; |
424 return promoCell; | 428 return promoCell; |
425 } | 429 } |
426 } | 430 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 _signinPromoViewMediator = nil; | 514 _signinPromoViewMediator = nil; |
511 } else { | 515 } else { |
512 _signinPromoViewMediator = [[SigninPromoViewMediator alloc] init]; | 516 _signinPromoViewMediator = [[SigninPromoViewMediator alloc] init]; |
513 _signinPromoViewMediator.consumer = self; | 517 _signinPromoViewMediator.consumer = self; |
514 } | 518 } |
515 } | 519 } |
516 [self.collectionView reloadData]; | 520 [self.collectionView reloadData]; |
517 } | 521 } |
518 } | 522 } |
519 | 523 |
524 - (void)dismissSigninPromo:(id)unused { | |
525 [self.delegate bookmarkCollectionViewDismissPromo:self]; | |
526 } | |
527 | |
520 #pragma mark - BookmarkPromoCellDelegate | 528 #pragma mark - BookmarkPromoCellDelegate |
521 | 529 |
522 - (void)bookmarkPromoCellDidTapSignIn:(BookmarkPromoCell*)bookmarkPromoCell { | 530 - (void)bookmarkPromoCellDidTapSignIn:(BookmarkPromoCell*)bookmarkPromoCell { |
523 [self.delegate bookmarkCollectionViewShowSignIn:self]; | 531 [self.delegate bookmarkCollectionViewShowSignIn:self]; |
524 } | 532 } |
525 | 533 |
526 - (void)bookmarkPromoCellDidTapDismiss:(BookmarkPromoCell*)bookmarkPromoCell { | 534 - (void)bookmarkPromoCellDidTapDismiss:(BookmarkPromoCell*)bookmarkPromoCell { |
527 [self.delegate bookmarkCollectionViewDismissPromo:self]; | 535 [self.delegate bookmarkCollectionViewDismissPromo:self]; |
528 } | 536 } |
529 | 537 |
(...skipping 18 matching lines...) Expand all Loading... | |
548 [NSIndexPath indexPathForRow:0 inSection:self.promoSection]; | 556 [NSIndexPath indexPathForRow:0 inSection:self.promoSection]; |
549 BookmarkSigninPromoCell* signinPromoCell = | 557 BookmarkSigninPromoCell* signinPromoCell = |
550 static_cast<BookmarkSigninPromoCell*>( | 558 static_cast<BookmarkSigninPromoCell*>( |
551 [self.collectionView cellForItemAtIndexPath:indexPath]); | 559 [self.collectionView cellForItemAtIndexPath:indexPath]); |
552 if (!signinPromoCell) | 560 if (!signinPromoCell) |
553 return; | 561 return; |
554 [configurator configureSigninPromoView:signinPromoCell.signinPromoView]; | 562 [configurator configureSigninPromoView:signinPromoCell.signinPromoView]; |
555 } | 563 } |
556 | 564 |
557 @end | 565 @end |
OLD | NEW |