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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.os.Handler; | 7 import android.os.Handler; |
8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
9 | 9 |
10 import org.chromium.chrome.browser.autofill.PersonalDataManager; | 10 import org.chromium.chrome.browser.autofill.PersonalDataManager; |
(...skipping 23 matching lines...) Expand all Loading... |
34 * Builds a payment app backed by autofill cards. | 34 * Builds a payment app backed by autofill cards. |
35 * | 35 * |
36 * @param webContents The web contents where PaymentRequest was invoked. | 36 * @param webContents The web contents where PaymentRequest was invoked. |
37 */ | 37 */ |
38 public AutofillPaymentApp(WebContents webContents) { | 38 public AutofillPaymentApp(WebContents webContents) { |
39 mWebContents = webContents; | 39 mWebContents = webContents; |
40 } | 40 } |
41 | 41 |
42 @Override | 42 @Override |
43 public void getInstruments(Map<String, PaymentMethodData> methodDataMap, Str
ing unusedOrigin, | 43 public void getInstruments(Map<String, PaymentMethodData> methodDataMap, Str
ing unusedOrigin, |
44 byte[][] unusedCertificateChain, final InstrumentsCallback callback)
{ | 44 String unusedIFRameOrigin, byte[][] unusedCertificateChain, |
| 45 final InstrumentsCallback callback) { |
45 PersonalDataManager pdm = PersonalDataManager.getInstance(); | 46 PersonalDataManager pdm = PersonalDataManager.getInstance(); |
46 List<CreditCard> cards = pdm.getCreditCardsToSuggest(); | 47 List<CreditCard> cards = pdm.getCreditCardsToSuggest(); |
47 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size()
); | 48 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size()
); |
48 | 49 |
49 Set<String> basicCardSupportedNetworks = | 50 Set<String> basicCardSupportedNetworks = |
50 convertBasicCardToNetworks(methodDataMap.get(BASIC_CARD_METHOD_N
AME)); | 51 convertBasicCardToNetworks(methodDataMap.get(BASIC_CARD_METHOD_N
AME)); |
51 | 52 |
52 for (int i = 0; i < cards.size(); i++) { | 53 for (int i = 0; i < cards.size(); i++) { |
53 CreditCard card = cards.get(i); | 54 CreditCard card = cards.get(i); |
54 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd
dressId()) | 55 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd
dressId()) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 Set<String> methodNames = new HashSet<>(methodDataMap.keySet()); | 139 Set<String> methodNames = new HashSet<>(methodDataMap.keySet()); |
139 methodNames.retainAll(getNetworks().values()); | 140 methodNames.retainAll(getNetworks().values()); |
140 return !methodNames.isEmpty(); | 141 return !methodNames.isEmpty(); |
141 } | 142 } |
142 | 143 |
143 @Override | 144 @Override |
144 public String getAppIdentifier() { | 145 public String getAppIdentifier() { |
145 return "Chrome_Autofill_Payment_App"; | 146 return "Chrome_Autofill_Payment_App"; |
146 } | 147 } |
147 } | 148 } |
OLD | NEW |