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/autofill/cells/storage_switch_item.h" | 5 #import "ios/chrome/browser/ui/autofill/cells/storage_switch_item.h" |
6 | 6 |
7 #include "components/grit/components_scaled_resources.h" | 7 #include "components/grit/components_scaled_resources.h" |
8 #include "components/strings/grit/components_strings.h" | 8 #include "components/strings/grit/components_strings.h" |
9 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 9 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
10 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 10 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
11 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 11 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
12 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
13 #include "ui/base/l10n/l10n_util_mac.h" | 13 #include "ui/base/l10n/l10n_util_mac.h" |
14 | 14 |
15 #if !defined(__has_feature) || !__has_feature(objc_arc) | 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
16 #error "This file requires ARC support." | 16 #error "This file requires ARC support." |
17 #endif | 17 #endif |
18 | 18 |
19 namespace { | 19 namespace { |
20 // Padding used on the leading and trailing edges of the cell. | 20 // Padding used on the leading and trailing edges of the cell. |
21 const CGFloat kHorizontalPadding = 16; | 21 const CGFloat kHorizontalPadding = 16; |
22 // Padding used on the top and bottom edges of the cell. | 22 // Padding used on the top and bottom edges of the cell. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 _switchView = [[UISwitch alloc] init]; | 66 _switchView = [[UISwitch alloc] init]; |
67 _switchView.translatesAutoresizingMaskIntoConstraints = NO; | 67 _switchView.translatesAutoresizingMaskIntoConstraints = NO; |
68 [contentView addSubview:_switchView]; | 68 [contentView addSubview:_switchView]; |
69 | 69 |
70 _tooltipButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 70 _tooltipButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
71 _tooltipButton.translatesAutoresizingMaskIntoConstraints = NO; | 71 _tooltipButton.translatesAutoresizingMaskIntoConstraints = NO; |
72 [contentView addSubview:_tooltipButton]; | 72 [contentView addSubview:_tooltipButton]; |
73 | 73 |
74 _textLabel.text = l10n_util::GetNSString( | 74 _textLabel.text = l10n_util::GetNSString( |
75 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX); | 75 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_CHECKBOX); |
76 _textLabel.font = | 76 _textLabel.font = [[MDCTypography fontLoader] mediumFontOfSize:14]; |
77 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
78 _textLabel.textColor = [[MDCPalette greyPalette] tint500]; | 77 _textLabel.textColor = [[MDCPalette greyPalette] tint500]; |
79 _textLabel.numberOfLines = 0; | 78 _textLabel.numberOfLines = 0; |
80 [_textLabel | 79 [_textLabel |
81 setContentCompressionResistancePriority:UILayoutPriorityDefaultLow | 80 setContentCompressionResistancePriority:UILayoutPriorityDefaultLow |
82 forAxis: | 81 forAxis: |
83 UILayoutConstraintAxisHorizontal]; | 82 UILayoutConstraintAxisHorizontal]; |
84 | 83 |
85 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500]; | 84 _switchView.onTintColor = [[MDCPalette cr_bluePalette] tint500]; |
86 | 85 |
87 [_tooltipButton setImage:NativeImage(IDR_AUTOFILL_TOOLTIP_ICON_H) | 86 [_tooltipButton setImage:NativeImage(IDR_AUTOFILL_TOOLTIP_ICON_H) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 [super prepareForReuse]; | 136 [super prepareForReuse]; |
138 [self.tooltipButton removeTarget:nil | 137 [self.tooltipButton removeTarget:nil |
139 action:nil | 138 action:nil |
140 forControlEvents:self.tooltipButton.allControlEvents]; | 139 forControlEvents:self.tooltipButton.allControlEvents]; |
141 [self.switchView removeTarget:nil | 140 [self.switchView removeTarget:nil |
142 action:nil | 141 action:nil |
143 forControlEvents:self.switchView.allControlEvents]; | 142 forControlEvents:self.switchView.allControlEvents]; |
144 } | 143 } |
145 | 144 |
146 @end | 145 @end |
OLD | NEW |