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/payments/cells/page_info_item.h" | 5 #import "ios/chrome/browser/ui/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_components_ios/src/components/Typography/src/M
aterialTypography.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; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = [[MDCTypography fontLoader] mediumFontOfSize:12]; |
76 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:12]; | |
77 _pageTitleLabel.textColor = [[MDCPalette greyPalette] tint900]; | 76 _pageTitleLabel.textColor = [[MDCPalette greyPalette] tint900]; |
78 _pageTitleLabel.backgroundColor = [UIColor clearColor]; | 77 _pageTitleLabel.backgroundColor = [UIColor clearColor]; |
79 _pageTitleLabel.translatesAutoresizingMaskIntoConstraints = NO; | 78 _pageTitleLabel.translatesAutoresizingMaskIntoConstraints = NO; |
80 [self.contentView addSubview:_pageTitleLabel]; | 79 [self.contentView addSubview:_pageTitleLabel]; |
81 | 80 |
82 // Page host | 81 // Page host |
83 _pageHostLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 82 _pageHostLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
84 _pageHostLabel.font = | 83 _pageHostLabel.font = [[MDCTypography fontLoader] regularFontOfSize:12]; |
85 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; | |
86 _pageHostLabel.textColor = [[MDCPalette greyPalette] tint600]; | 84 _pageHostLabel.textColor = [[MDCPalette greyPalette] tint600]; |
87 // Allow the label to break to multiple lines. This should be very rare but | 85 // Allow the label to break to multiple lines. This should be very rare but |
88 // will prevent malicious domains from suppling very long host names and | 86 // will prevent malicious domains from suppling very long host names and |
89 // having the domain name truncated. | 87 // having the domain name truncated. |
90 _pageHostLabel.numberOfLines = 0; | 88 _pageHostLabel.numberOfLines = 0; |
91 _pageHostLabel.backgroundColor = [UIColor clearColor]; | 89 _pageHostLabel.backgroundColor = [UIColor clearColor]; |
92 _pageHostLabel.translatesAutoresizingMaskIntoConstraints = NO; | 90 _pageHostLabel.translatesAutoresizingMaskIntoConstraints = NO; |
93 [self.contentView addSubview:_pageHostLabel]; | 91 [self.contentView addSubview:_pageHostLabel]; |
94 | 92 |
95 // Layout | 93 // Layout |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 153 } |
156 | 154 |
157 #pragma mark - Accessibility | 155 #pragma mark - Accessibility |
158 | 156 |
159 - (NSString*)accessibilityLabel { | 157 - (NSString*)accessibilityLabel { |
160 return [NSString stringWithFormat:@"%@, %@", self.pageTitleLabel.text, | 158 return [NSString stringWithFormat:@"%@, %@", self.pageTitleLabel.text, |
161 self.pageHostLabel.text]; | 159 self.pageHostLabel.text]; |
162 } | 160 } |
163 | 161 |
164 @end | 162 @end |
OLD | NEW |