Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: ios/chrome/browser/payments/payment_request_selector_view_controller.mm

Issue 2826713002: [Payment Request] Refactors the remaining selector view controllers (Closed)
Patch Set: Addressed comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/payment_request_selector_view_controller.h" 5 #import "ios/chrome/browser/payments/payment_request_selector_view_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #import "ios/chrome/browser/payments/cells/payments_text_item.h" 9 #import "ios/chrome/browser/payments/cells/payments_text_item.h"
10 #import "ios/chrome/browser/payments/payment_request_selector_view_controller_ac tions.h" 10 #import "ios/chrome/browser/payments/payment_request_selector_view_controller_ac tions.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if ([cell isKindOfClass:[PaymentsTextCell class]]) { 144 if ([cell isKindOfClass:[PaymentsTextCell class]]) {
145 PaymentsTextCell* textCell = 145 PaymentsTextCell* textCell =
146 base::mac::ObjCCastStrict<PaymentsTextCell>(cell); 146 base::mac::ObjCCastStrict<PaymentsTextCell>(cell);
147 textCell.textLabel.textColor = 147 textCell.textLabel.textColor =
148 self.dataSource.state == PaymentRequestSelectorStateError 148 self.dataSource.state == PaymentRequestSelectorStateError
149 ? [[MDCPalette cr_redPalette] tint600] 149 ? [[MDCPalette cr_redPalette] tint600]
150 : [[MDCPalette greyPalette] tint600]; 150 : [[MDCPalette greyPalette] tint600];
151 } 151 }
152 break; 152 break;
153 } 153 }
154 case ItemTypeSelectableItem: {
155 if ([cell isKindOfClass:[PaymentsTextCell class]]) {
156 PaymentsTextCell* textCell =
157 base::mac::ObjCCastStrict<PaymentsTextCell>(cell);
158 textCell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
159 }
160 break;
161 }
154 default: 162 default:
155 break; 163 break;
156 } 164 }
157 165
158 return cell; 166 return cell;
159 } 167 }
160 168
161 #pragma mark UICollectionViewDelegate 169 #pragma mark UICollectionViewDelegate
162 170
163 - (void)collectionView:(UICollectionView*)collectionView 171 - (void)collectionView:(UICollectionView*)collectionView
(...skipping 23 matching lines...) Expand all
187 195
188 // Notify the delegate of the selection. 196 // Notify the delegate of the selection.
189 NSUInteger index = 197 NSUInteger index =
190 [self.collectionViewModel indexInItemTypeForIndexPath:indexPath]; 198 [self.collectionViewModel indexInItemTypeForIndexPath:indexPath];
191 DCHECK(index < [[self.dataSource selectableItems] count]); 199 DCHECK(index < [[self.dataSource selectableItems] count]);
192 [self.delegate paymentRequestSelectorViewController:self 200 [self.delegate paymentRequestSelectorViewController:self
193 didSelectItemAtIndex:index]; 201 didSelectItemAtIndex:index];
194 break; 202 break;
195 } 203 }
196 case ItemTypeAddItem: { 204 case ItemTypeAddItem: {
197 [self.delegate paymentRequestSelectorViewControllerDidSelectAddItem:self]; 205 if ([self.delegate
206 respondsToSelector:@selector
207 (paymentRequestSelectorViewControllerDidSelectAddItem:)]) {
208 [self.delegate
209 paymentRequestSelectorViewControllerDidSelectAddItem:self];
210 }
198 break; 211 break;
199 } 212 }
200 default: 213 default:
201 break; 214 break;
202 } 215 }
203 } 216 }
204 217
205 #pragma mark MDCCollectionViewStylingDelegate 218 #pragma mark MDCCollectionViewStylingDelegate
206 219
207 - (CGFloat)collectionView:(UICollectionView*)collectionView 220 - (CGFloat)collectionView:(UICollectionView*)collectionView
(...skipping 15 matching lines...) Expand all
223 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { 236 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
224 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; 237 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath];
225 if (type == ItemTypeHeader) { 238 if (type == ItemTypeHeader) {
226 return YES; 239 return YES;
227 } else { 240 } else {
228 return NO; 241 return NO;
229 } 242 }
230 } 243 }
231 244
232 @end 245 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698