Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.mm

Issue 2761753002: Cleanup ContentSuggestions cells (Closed)
Patch Set: Fix tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.mm
deleted file mode 100644
index f58a145abac834c970ac329108138efd21c7fea2..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.mm
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.h"
-
-#import "ios/chrome/browser/ui/uikit_ui_util.h"
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
-namespace {
-const CGFloat kMinimalCellHeight = 44;
-}
-
-#pragma mark - ContentSuggestionsFooterItem
-
-@interface ContentSuggestionsFooterItem ()
-
-@property(nonatomic, copy) NSString* title;
-@property(nonatomic, copy) ProceduralBlock block;
-
-@end
-
-@implementation ContentSuggestionsFooterItem
-
-@synthesize title = _title;
-@synthesize block = _block;
-
-- (instancetype)initWithType:(NSInteger)type
- title:(NSString*)title
- block:(ProceduralBlock)block {
- self = [super initWithType:type];
- if (self) {
- self.cellClass = [ContentSuggestionsFooterCell class];
- _title = [title copy];
- _block = [block copy];
- }
- return self;
-}
-
-- (void)configureCell:(ContentSuggestionsFooterCell*)cell {
- [super configureCell:cell];
- [cell.button setTitle:self.title forState:UIControlStateNormal];
- [cell.button addTarget:self
- action:@selector(executeBlock)
- forControlEvents:UIControlEventTouchUpInside];
-}
-
-#pragma mark - Private
-
-// Executes the |_block| if not nil.
-- (void)executeBlock {
- if (self.block) {
- self.block();
- }
-}
-
-@end
-
-#pragma mark - ContentSuggestionsFooterCell
-
-@implementation ContentSuggestionsFooterCell
-
-@synthesize button = _button;
-
-- (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- _button = [UIButton buttonWithType:UIButtonTypeSystem];
- _button.translatesAutoresizingMaskIntoConstraints = NO;
- [self.contentView addSubview:_button];
- [_button.heightAnchor
- constraintGreaterThanOrEqualToConstant:kMinimalCellHeight]
- .active = YES;
- AddSameSizeConstraint(self.contentView, _button);
- }
- return self;
-}
-
-- (void)prepareForReuse {
- [self.button removeTarget:nil
- action:NULL
- forControlEvents:UIControlEventAllEvents];
-}
-
-@end

Powered by Google App Engine
This is Rietveld 408576698