| 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/payments/cells/page_info_item.h" | 5 #import "ios/chrome/browser/payments/cells/page_info_item.h" |
| 6 | 6 |
| 7 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 7 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 8 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." | 11 #error "This file requires ARC support." |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 NSString* const kPageInfoFaviconImageViewId = @"kPageInfoFaviconImageViewId"; | |
| 15 | |
| 16 namespace { | 14 namespace { |
| 17 // Padding used on the top and bottom edges of the cell. | 15 // Padding used on the top and bottom edges of the cell. |
| 18 const CGFloat kVerticalPadding = 12; | 16 const CGFloat kVerticalPadding = 12; |
| 19 | 17 |
| 20 // Padding used on the leading and trailing edges of the cell and between the | 18 // Padding used on the leading and trailing edges of the cell and between the |
| 21 // favicon and labels. | 19 // favicon and labels. |
| 22 const CGFloat kHorizontalPadding = 16; | 20 const CGFloat kHorizontalPadding = 16; |
| 23 } | 21 } |
| 24 | 22 |
| 25 @implementation PageInfoItem | 23 @implementation PageInfoItem |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 @synthesize pageFaviconView = _pageFaviconView; | 58 @synthesize pageFaviconView = _pageFaviconView; |
| 61 | 59 |
| 62 - (instancetype)initWithFrame:(CGRect)frame { | 60 - (instancetype)initWithFrame:(CGRect)frame { |
| 63 self = [super initWithFrame:frame]; | 61 self = [super initWithFrame:frame]; |
| 64 if (self) { | 62 if (self) { |
| 65 self.isAccessibilityElement = YES; | 63 self.isAccessibilityElement = YES; |
| 66 | 64 |
| 67 // Favicon | 65 // Favicon |
| 68 _pageFaviconView = [[UIImageView alloc] initWithFrame:CGRectZero]; | 66 _pageFaviconView = [[UIImageView alloc] initWithFrame:CGRectZero]; |
| 69 _pageFaviconView.translatesAutoresizingMaskIntoConstraints = NO; | 67 _pageFaviconView.translatesAutoresizingMaskIntoConstraints = NO; |
| 70 _pageFaviconView.accessibilityIdentifier = kPageInfoFaviconImageViewId; | |
| 71 [self.contentView addSubview:_pageFaviconView]; | 68 [self.contentView addSubview:_pageFaviconView]; |
| 72 | 69 |
| 73 // Page title | 70 // Page title |
| 74 _pageTitleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 71 _pageTitleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 75 _pageTitleLabel.font = | 72 _pageTitleLabel.font = |
| 76 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:12]; | 73 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:12]; |
| 77 _pageTitleLabel.textColor = [[MDCPalette greyPalette] tint900]; | 74 _pageTitleLabel.textColor = [[MDCPalette greyPalette] tint900]; |
| 78 _pageTitleLabel.backgroundColor = [UIColor clearColor]; | 75 _pageTitleLabel.backgroundColor = [UIColor clearColor]; |
| 79 _pageTitleLabel.translatesAutoresizingMaskIntoConstraints = NO; | 76 _pageTitleLabel.translatesAutoresizingMaskIntoConstraints = NO; |
| 80 [self.contentView addSubview:_pageTitleLabel]; | 77 [self.contentView addSubview:_pageTitleLabel]; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 152 } |
| 156 | 153 |
| 157 #pragma mark - Accessibility | 154 #pragma mark - Accessibility |
| 158 | 155 |
| 159 - (NSString*)accessibilityLabel { | 156 - (NSString*)accessibilityLabel { |
| 160 return [NSString stringWithFormat:@"%@, %@", self.pageTitleLabel.text, | 157 return [NSString stringWithFormat:@"%@, %@", self.pageTitleLabel.text, |
| 161 self.pageHostLabel.text]; | 158 self.pageHostLabel.text]; |
| 162 } | 159 } |
| 163 | 160 |
| 164 @end | 161 @end |
| OLD | NEW |