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