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

Unified Diff: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm

Issue 2887433002: Move the ContentSuggestions items to a new target (Closed)
Patch Set: Created 3 years, 7 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/cells/content_suggestions_most_visited_item.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm
index ab0c47fc9aab8c21a1e48df2e2b9bcc218f81401..59b694390065a8b77aea1973ca87dbfb53680f04 100644
--- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm
+++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.mm
@@ -4,29 +4,16 @@
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h"
+#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_cell.h"
#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/favicon/favicon_attributes.h"
#import "ios/chrome/browser/ui/favicon/favicon_view.h"
-#import "ios/chrome/browser/ui/uikit_ui_util.h"
-#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
-namespace {
-const CGFloat kLabelTextColor = 0.314;
-const NSInteger kLabelNumLines = 2;
-const CGFloat kFaviconSize = 48;
-const CGFloat kSpaceFaviconTitle = 10;
-
-// Size of a Most Visited cell.
-const CGSize kCellSize = {73, 100};
-}
-
-#pragma mark - ContentSuggestionsMostVisitedItem
-
@implementation ContentSuggestionsMostVisitedItem
@synthesize suggestionIdentifier = _suggestionIdentifier;
@@ -52,60 +39,3 @@ const CGSize kCellSize = {73, 100};
}
@end
-
-#pragma mark - ContentSuggestionsMostVisitedCell
-
-@implementation ContentSuggestionsMostVisitedCell : MDCCollectionViewCell
-
-@synthesize faviconView = _faviconView;
-@synthesize titleLabel = _titleLabel;
-
-#pragma mark - Public
-
-- (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- _titleLabel = [[UILabel alloc] init];
- _titleLabel.textColor = [UIColor colorWithWhite:kLabelTextColor alpha:1.0];
- _titleLabel.font = [MDCTypography captionFont];
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- _titleLabel.preferredMaxLayoutWidth = [[self class] defaultSize].width;
- _titleLabel.numberOfLines = kLabelNumLines;
-
- _faviconView = [[FaviconViewNew alloc] init];
- _faviconView.font = [MDCTypography headlineFont];
-
- _titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
- _faviconView.translatesAutoresizingMaskIntoConstraints = NO;
-
- [self addSubview:_titleLabel];
- [self addSubview:_faviconView];
-
- [NSLayoutConstraint activateConstraints:@[
- [_faviconView.widthAnchor constraintEqualToConstant:kFaviconSize],
- [_faviconView.heightAnchor
- constraintEqualToAnchor:_faviconView.widthAnchor],
- [_faviconView.centerXAnchor
- constraintEqualToAnchor:_titleLabel.centerXAnchor],
- ]];
-
- ApplyVisualConstraintsWithMetrics(
- @[ @"V:|[favicon]-(space)-[title]", @"H:|[title]|" ],
- @{ @"favicon" : _faviconView,
- @"title" : _titleLabel },
- @{ @"space" : @(kSpaceFaviconTitle) });
-
- self.isAccessibilityElement = YES;
- }
- return self;
-}
-
-+ (CGSize)defaultSize {
- return kCellSize;
-}
-
-- (CGSize)intrinsicContentSize {
- return [[self class] defaultSize];
-}
-
-@end

Powered by Google App Engine
This is Rietveld 408576698