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/shipping_address_selection_view_controller.
h" | 5 #import "ios/chrome/browser/payments/shipping_address_selection_view_controller.
h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
11 #include "components/payments/core/strings_util.h" | 11 #include "components/payments/core/strings_util.h" |
12 #include "components/strings/grit/components_strings.h" | 12 #include "components/strings/grit/components_strings.h" |
13 #include "ios/chrome/browser/application_context.h" | 13 #include "ios/chrome/browser/application_context.h" |
14 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h" | 14 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h" |
15 #import "ios/chrome/browser/payments/cells/payments_text_item.h" | 15 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
16 #include "ios/chrome/browser/payments/payment_request.h" | 16 #include "ios/chrome/browser/payments/payment_request.h" |
17 #import "ios/chrome/browser/payments/payment_request_util.h" | 17 #import "ios/chrome/browser/payments/payment_request_util.h" |
18 #import "ios/chrome/browser/payments/shipping_address_selection_view_controller_
actions.h" | 18 #import "ios/chrome/browser/payments/shipping_address_selection_view_controller_
actions.h" |
19 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" | 19 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" |
20 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" | 20 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" |
21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
22 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | |
23 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 22 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
24 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 23 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
25 #import "ios/chrome/browser/ui/icons/chrome_icon.h" | 24 #import "ios/chrome/browser/ui/icons/chrome_icon.h" |
26 #include "ios/chrome/browser/ui/uikit_ui_util.h" | 25 #include "ios/chrome/browser/ui/uikit_ui_util.h" |
27 #include "ios/chrome/grit/ios_strings.h" | 26 #include "ios/chrome/grit/ios_strings.h" |
28 #include "ios/chrome/grit/ios_theme_resources.h" | 27 #include "ios/chrome/grit/ios_theme_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
30 | 29 |
31 #if !defined(__has_feature) || !__has_feature(objc_arc) | 30 #if !defined(__has_feature) || !__has_feature(objc_arc) |
32 #error "This file requires ARC support." | 31 #error "This file requires ARC support." |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 175 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
177 switch (itemType) { | 176 switch (itemType) { |
178 case ItemTypeMessage: { | 177 case ItemTypeMessage: { |
179 PaymentsTextCell* messageCell = | 178 PaymentsTextCell* messageCell = |
180 base::mac::ObjCCastStrict<PaymentsTextCell>(cell); | 179 base::mac::ObjCCastStrict<PaymentsTextCell>(cell); |
181 messageCell.textLabel.textColor = | 180 messageCell.textLabel.textColor = |
182 _errorMessage ? [[MDCPalette cr_redPalette] tint600] | 181 _errorMessage ? [[MDCPalette cr_redPalette] tint600] |
183 : [[MDCPalette greyPalette] tint600]; | 182 : [[MDCPalette greyPalette] tint600]; |
184 break; | 183 break; |
185 } | 184 } |
186 case ItemTypeAddShippingAddress: { | |
187 PaymentsTextCell* addAddressCell = | |
188 base::mac::ObjCCastStrict<PaymentsTextCell>(cell); | |
189 addAddressCell.textLabel.textColor = [[MDCPalette greyPalette] tint900]; | |
190 break; | |
191 } | |
192 default: | 185 default: |
193 break; | 186 break; |
194 } | 187 } |
195 return cell; | 188 return cell; |
196 } | 189 } |
197 | 190 |
198 #pragma mark UICollectionViewDelegate | 191 #pragma mark UICollectionViewDelegate |
199 | 192 |
200 - (void)collectionView:(UICollectionView*)collectionView | 193 - (void)collectionView:(UICollectionView*)collectionView |
201 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { | 194 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { | 250 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { |
258 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 251 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
259 if (type == ItemTypeMessage) { | 252 if (type == ItemTypeMessage) { |
260 return YES; | 253 return YES; |
261 } else { | 254 } else { |
262 return NO; | 255 return NO; |
263 } | 256 } |
264 } | 257 } |
265 | 258 |
266 @end | 259 @end |
OLD | NEW |