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