| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/history/history_entry_item.h" | 5 #import "ios/chrome/browser/ui/history/history_entry_item.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/history/core/browser/url_row.h" | 11 #include "components/history/core/browser/url_row.h" |
| 12 #include "components/strings/grit/components_strings.h" | 12 #include "components/strings/grit/components_strings.h" |
| 13 #include "components/url_formatter/url_formatter.h" | 13 #include "components/url_formatter/url_formatter.h" |
| 14 #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" | 14 #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" |
| 15 #import "ios/chrome/browser/ui/history/favicon_view.h" | 15 #import "ios/chrome/browser/ui/history/favicon_view.h" |
| 16 #import "ios/chrome/browser/ui/history/favicon_view_provider.h" | 16 #import "ios/chrome/browser/ui/history/favicon_view_provider.h" |
| 17 #import "ios/chrome/browser/ui/history/history_entry.h" | 17 #import "ios/chrome/browser/ui/history/history_entry.h" |
| 18 #include "ios/chrome/browser/ui/rtl_geometry.h" | 18 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 19 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 19 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 20 #include "ios/chrome/grit/ios_strings.h" | 20 #include "ios/chrome/grit/ios_strings.h" |
| 21 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 21 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 22 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 22 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 | 24 |
| 25 #if !defined(__has_feature) || !__has_feature(objc_arc) | 25 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 26 #error "This file requires ARC support." | 26 #error "This file requires ARC support." |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 // Size at which the favicon will be displayed. | 30 // Size at which the favicon will be displayed. |
| 31 const CGFloat kFaviconSize = 24.0; | 31 const CGFloat kFaviconSize = 24.0; |
| 32 // Minimum size at which to fetch favicons. | 32 // Minimum size at which to fetch favicons. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 @synthesize detailTextLabel = _detailTextLabel; | 233 @synthesize detailTextLabel = _detailTextLabel; |
| 234 @synthesize timeLabel = _timeLabel; | 234 @synthesize timeLabel = _timeLabel; |
| 235 | 235 |
| 236 - (id)initWithFrame:(CGRect)frame { | 236 - (id)initWithFrame:(CGRect)frame { |
| 237 self = [super initWithFrame:frame]; | 237 self = [super initWithFrame:frame]; |
| 238 if (self) { | 238 if (self) { |
| 239 | 239 |
| 240 _faviconViewContainer = [[UIView alloc] initWithFrame:CGRectZero]; | 240 _faviconViewContainer = [[UIView alloc] initWithFrame:CGRectZero]; |
| 241 | 241 |
| 242 _textLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 242 _textLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 243 [_textLabel | 243 [_textLabel setFont:[[MDCTypography fontLoader] mediumFontOfSize:16]]; |
| 244 setFont:[[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:16]]; | |
| 245 [_textLabel setTextColor:[[MDCPalette greyPalette] tint900]]; | 244 [_textLabel setTextColor:[[MDCPalette greyPalette] tint900]]; |
| 246 | 245 |
| 247 _detailTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 246 _detailTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 248 [_detailTextLabel | 247 [_detailTextLabel |
| 249 setFont:[[MDFRobotoFontLoader sharedInstance] regularFontOfSize:14]]; | 248 setFont:[[MDCTypography fontLoader] regularFontOfSize:14]]; |
| 250 [_detailTextLabel setTextColor:[[MDCPalette greyPalette] tint600]]; | 249 [_detailTextLabel setTextColor:[[MDCPalette greyPalette] tint600]]; |
| 251 | 250 |
| 252 _timeLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 251 _timeLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 253 [_timeLabel | 252 [_timeLabel setFont:[[MDCTypography fontLoader] mediumFontOfSize:14]]; |
| 254 setFont:[[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]]; | |
| 255 [_timeLabel setTextColor:[[MDCPalette greyPalette] tint600]]; | 253 [_timeLabel setTextColor:[[MDCPalette greyPalette] tint600]]; |
| 256 _timeLabel.textAlignment = | 254 _timeLabel.textAlignment = |
| 257 UseRTLLayout() ? NSTextAlignmentLeft : NSTextAlignmentRight; | 255 UseRTLLayout() ? NSTextAlignmentLeft : NSTextAlignmentRight; |
| 258 | 256 |
| 259 UIView* contentView = self.contentView; | 257 UIView* contentView = self.contentView; |
| 260 [contentView addSubview:_faviconViewContainer]; | 258 [contentView addSubview:_faviconViewContainer]; |
| 261 [contentView addSubview:_textLabel]; | 259 [contentView addSubview:_textLabel]; |
| 262 [contentView addSubview:_detailTextLabel]; | 260 [contentView addSubview:_detailTextLabel]; |
| 263 [contentView addSubview:_timeLabel]; | 261 [contentView addSubview:_timeLabel]; |
| 264 | 262 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 [super prepareForReuse]; | 298 [super prepareForReuse]; |
| 301 _textLabel.text = nil; | 299 _textLabel.text = nil; |
| 302 _detailTextLabel.text = nil; | 300 _detailTextLabel.text = nil; |
| 303 _timeLabel.text = nil; | 301 _timeLabel.text = nil; |
| 304 for (UIView* subview in _faviconViewContainer.subviews) { | 302 for (UIView* subview in _faviconViewContainer.subviews) { |
| 305 [subview removeFromSuperview]; | 303 [subview removeFromSuperview]; |
| 306 } | 304 } |
| 307 } | 305 } |
| 308 | 306 |
| 309 @end | 307 @end |
| OLD | NEW |