| OLD | NEW |
| 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/contact_info_edit_mediator.h" | 5 #import "ios/chrome/browser/ui/payments/contact_info_edit_mediator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 #if !defined(__has_feature) || !__has_feature(objc_arc) | 22 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 23 #error "This file requires ARC support." | 23 #error "This file requires ARC support." |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 @interface ContactInfoEditMediator () | 26 @interface ContactInfoEditMediator () |
| 27 | 27 |
| 28 // The PaymentRequest object owning an instance of web::PaymentRequest as | 28 // The PaymentRequest object owning an instance of web::PaymentRequest as |
| 29 // provided by the page invoking the Payment Request API. This is a weak | 29 // provided by the page invoking the Payment Request API. This is a weak |
| 30 // pointer and should outlive this class. | 30 // pointer and should outlive this class. |
| 31 @property(nonatomic, assign) PaymentRequest* paymentRequest; | 31 @property(nonatomic, assign) payments::PaymentRequest* paymentRequest; |
| 32 | 32 |
| 33 // The profile to be edited, if any. This pointer is not owned by this class and | 33 // The profile to be edited, if any. This pointer is not owned by this class and |
| 34 // should outlive it. | 34 // should outlive it. |
| 35 @property(nonatomic, assign) autofill::AutofillProfile* profile; | 35 @property(nonatomic, assign) autofill::AutofillProfile* profile; |
| 36 | 36 |
| 37 // The list of current editor fields. | 37 // The list of current editor fields. |
| 38 @property(nonatomic, strong) NSMutableArray<EditorField*>* fields; | 38 @property(nonatomic, strong) NSMutableArray<EditorField*>* fields; |
| 39 | 39 |
| 40 @end | 40 @end |
| 41 | 41 |
| 42 @implementation ContactInfoEditMediator | 42 @implementation ContactInfoEditMediator |
| 43 | 43 |
| 44 @synthesize state = _state; | 44 @synthesize state = _state; |
| 45 @synthesize consumer = _consumer; | 45 @synthesize consumer = _consumer; |
| 46 @synthesize paymentRequest = _paymentRequest; | 46 @synthesize paymentRequest = _paymentRequest; |
| 47 @synthesize profile = _profile; | 47 @synthesize profile = _profile; |
| 48 @synthesize fields = _fields; | 48 @synthesize fields = _fields; |
| 49 | 49 |
| 50 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest | 50 - (instancetype)initWithPaymentRequest:(payments::PaymentRequest*)paymentRequest |
| 51 profile:(autofill::AutofillProfile*)profile { | 51 profile:(autofill::AutofillProfile*)profile { |
| 52 self = [super init]; | 52 self = [super init]; |
| 53 if (self) { | 53 if (self) { |
| 54 _paymentRequest = paymentRequest; | 54 _paymentRequest = paymentRequest; |
| 55 _profile = profile; | 55 _profile = profile; |
| 56 _state = | 56 _state = |
| 57 _profile ? EditViewControllerStateEdit : EditViewControllerStateCreate; | 57 _profile ? EditViewControllerStateEdit : EditViewControllerStateCreate; |
| 58 } | 58 } |
| 59 return self; | 59 return self; |
| 60 } | 60 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // corresponding field value. Returns nil if |profile| is nullptr. | 161 // corresponding field value. Returns nil if |profile| is nullptr. |
| 162 - (NSString*)fieldValueFromProfile:(autofill::AutofillProfile*)profile | 162 - (NSString*)fieldValueFromProfile:(autofill::AutofillProfile*)profile |
| 163 fieldType:(autofill::ServerFieldType)fieldType { | 163 fieldType:(autofill::ServerFieldType)fieldType { |
| 164 return profile ? base::SysUTF16ToNSString(profile->GetInfo( | 164 return profile ? base::SysUTF16ToNSString(profile->GetInfo( |
| 165 autofill::AutofillType(fieldType), | 165 autofill::AutofillType(fieldType), |
| 166 GetApplicationContext()->GetApplicationLocale())) | 166 GetApplicationContext()->GetApplicationLocale())) |
| 167 : nil; | 167 : nil; |
| 168 } | 168 } |
| 169 | 169 |
| 170 @end | 170 @end |
| OLD | NEW |