| 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 <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #import "ios/chrome/browser/ui/payments/payment_items_display_mediator.h" | 8 #import "ios/chrome/browser/ui/payments/payment_items_display_mediator.h" |
| 9 | 9 |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/payments/core/currency_formatter.h" | 12 #include "components/payments/core/currency_formatter.h" |
| 13 #include "components/strings/grit/components_strings.h" | 13 #include "components/strings/grit/components_strings.h" |
| 14 #include "ios/chrome/browser/payments/payment_request.h" | 14 #include "ios/chrome/browser/payments/payment_request.h" |
| 15 #import "ios/chrome/browser/ui/payments/cells/price_item.h" | 15 #import "ios/chrome/browser/ui/payments/cells/price_item.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) | 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." | 19 #error "This file requires ARC support." |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 @interface PaymentItemsDisplayMediator () | 22 @interface PaymentItemsDisplayMediator () |
| 23 | 23 |
| 24 // The PaymentRequest object owning an instance of web::PaymentRequest as | 24 // The PaymentRequest object owning an instance of web::PaymentRequest as |
| 25 // provided by the page invoking the Payment Request API. This is a weak | 25 // provided by the page invoking the Payment Request API. This is a weak |
| 26 // pointer and should outlive this class. | 26 // pointer and should outlive this class. |
| 27 @property(nonatomic, assign) PaymentRequest* paymentRequest; | 27 @property(nonatomic, assign) payments::PaymentRequest* paymentRequest; |
| 28 | 28 |
| 29 @end | 29 @end |
| 30 | 30 |
| 31 @implementation PaymentItemsDisplayMediator | 31 @implementation PaymentItemsDisplayMediator |
| 32 | 32 |
| 33 @synthesize paymentRequest = _paymentRequest; | 33 @synthesize paymentRequest = _paymentRequest; |
| 34 | 34 |
| 35 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { | 35 - (instancetype)initWithPaymentRequest: |
| 36 (payments::PaymentRequest*)paymentRequest { |
| 36 self = [super init]; | 37 self = [super init]; |
| 37 if (self) { | 38 if (self) { |
| 38 _paymentRequest = paymentRequest; | 39 _paymentRequest = paymentRequest; |
| 39 } | 40 } |
| 40 return self; | 41 return self; |
| 41 } | 42 } |
| 42 | 43 |
| 43 #pragma mark - PaymentItemsDisplayViewControllerDataSource | 44 #pragma mark - PaymentItemsDisplayViewControllerDataSource |
| 44 | 45 |
| 45 - (CollectionViewItem*)totalItem { | 46 - (CollectionViewItem*)totalItem { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 69 _paymentRequest->GetOrCreateCurrencyFormatter(); | 70 _paymentRequest->GetOrCreateCurrencyFormatter(); |
| 70 item.price = SysUTF16ToNSString(currencyFormatter->Format( | 71 item.price = SysUTF16ToNSString(currencyFormatter->Format( |
| 71 base::UTF16ToASCII(paymentItem.amount.value))); | 72 base::UTF16ToASCII(paymentItem.amount.value))); |
| 72 | 73 |
| 73 [lineItems addObject:item]; | 74 [lineItems addObject:item]; |
| 74 } | 75 } |
| 75 return lineItems; | 76 return lineItems; |
| 76 } | 77 } |
| 77 | 78 |
| 78 @end | 79 @end |
| OLD | NEW |