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

Side by Side Diff: ios/chrome/browser/ui/payments/address_edit_mediator.mm

Issue 2965073002: [Payment Request] Moves PaymentRequest into the payments namespace (Closed)
Patch Set: rebase Created 3 years, 5 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/ui/payments/address_edit_mediator.h" 5 #import "ios/chrome/browser/ui/payments/address_edit_mediator.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 26 matching lines...) Expand all
37 #error "This file requires ARC support." 37 #error "This file requires ARC support."
38 #endif 38 #endif
39 39
40 @interface AddressEditMediator () { 40 @interface AddressEditMediator () {
41 std::unique_ptr<RegionDataLoader> _regionDataLoader; 41 std::unique_ptr<RegionDataLoader> _regionDataLoader;
42 } 42 }
43 43
44 // The PaymentRequest object owning an instance of web::PaymentRequest as 44 // The PaymentRequest object owning an instance of web::PaymentRequest as
45 // provided by the page invoking the Payment Request API. This is a weak 45 // provided by the page invoking the Payment Request API. This is a weak
46 // pointer and should outlive this class. 46 // pointer and should outlive this class.
47 @property(nonatomic, assign) PaymentRequest* paymentRequest; 47 @property(nonatomic, assign) payments::PaymentRequest* paymentRequest;
48 48
49 // The address to be edited, if any. This pointer is not owned by this class and 49 // The address to be edited, if any. This pointer is not owned by this class and
50 // should outlive it. 50 // should outlive it.
51 @property(nonatomic, assign) autofill::AutofillProfile* address; 51 @property(nonatomic, assign) autofill::AutofillProfile* address;
52 52
53 // The map of autofill types to the cached editor fields. Helps reuse the editor 53 // The map of autofill types to the cached editor fields. Helps reuse the editor
54 // fields and therefore maintain their existing values when the selected country 54 // fields and therefore maintain their existing values when the selected country
55 // changes and the editor fields get updated. 55 // changes and the editor fields get updated.
56 @property(nonatomic, strong) 56 @property(nonatomic, strong)
57 NSMutableDictionary<NSNumber*, EditorField*>* fieldsMap; 57 NSMutableDictionary<NSNumber*, EditorField*>* fieldsMap;
(...skipping 11 matching lines...) Expand all
69 @synthesize state = _state; 69 @synthesize state = _state;
70 @synthesize consumer = _consumer; 70 @synthesize consumer = _consumer;
71 @synthesize countries = _countries; 71 @synthesize countries = _countries;
72 @synthesize selectedCountryCode = _selectedCountryCode; 72 @synthesize selectedCountryCode = _selectedCountryCode;
73 @synthesize paymentRequest = _paymentRequest; 73 @synthesize paymentRequest = _paymentRequest;
74 @synthesize address = _address; 74 @synthesize address = _address;
75 @synthesize fieldsMap = _fieldsMap; 75 @synthesize fieldsMap = _fieldsMap;
76 @synthesize fields = _fields; 76 @synthesize fields = _fields;
77 @synthesize regionField = _regionField; 77 @synthesize regionField = _regionField;
78 78
79 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest 79 - (instancetype)initWithPaymentRequest:(payments::PaymentRequest*)paymentRequest
80 address:(autofill::AutofillProfile*)address { 80 address:(autofill::AutofillProfile*)address {
81 self = [super init]; 81 self = [super init];
82 if (self) { 82 if (self) {
83 _paymentRequest = paymentRequest; 83 _paymentRequest = paymentRequest;
84 _address = address; 84 _address = address;
85 _state = 85 _state =
86 _address ? EditViewControllerStateEdit : EditViewControllerStateCreate; 86 _address ? EditViewControllerStateEdit : EditViewControllerStateCreate;
87 _fieldsMap = [[NSMutableDictionary alloc] init]; 87 _fieldsMap = [[NSMutableDictionary alloc] init];
88 [self loadCountries]; 88 [self loadCountries];
89 } 89 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // corresponding field value. Returns nil if |profile| is nullptr. 350 // corresponding field value. Returns nil if |profile| is nullptr.
351 - (NSString*)fieldValueFromProfile:(autofill::AutofillProfile*)profile 351 - (NSString*)fieldValueFromProfile:(autofill::AutofillProfile*)profile
352 fieldType:(autofill::ServerFieldType)fieldType { 352 fieldType:(autofill::ServerFieldType)fieldType {
353 return profile ? base::SysUTF16ToNSString(profile->GetInfo( 353 return profile ? base::SysUTF16ToNSString(profile->GetInfo(
354 autofill::AutofillType(fieldType), 354 autofill::AutofillType(fieldType),
355 GetApplicationContext()->GetApplicationLocale())) 355 GetApplicationContext()->GetApplicationLocale()))
356 : nil; 356 : nil;
357 } 357 }
358 358
359 @end 359 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698