| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 public void getInstruments( | 42 public void getInstruments( |
| 43 Map<String, PaymentMethodData> unusedMethodData, final InstrumentsCa
llback callback) { | 43 Map<String, PaymentMethodData> unusedMethodData, final InstrumentsCa
llback callback) { |
| 44 PersonalDataManager pdm = PersonalDataManager.getInstance(); | 44 PersonalDataManager pdm = PersonalDataManager.getInstance(); |
| 45 List<CreditCard> cards = pdm.getCreditCardsToSuggest(); | 45 List<CreditCard> cards = pdm.getCreditCardsToSuggest(); |
| 46 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size()
); | 46 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size()
); |
| 47 | 47 |
| 48 for (int i = 0; i < cards.size(); i++) { | 48 for (int i = 0; i < cards.size(); i++) { |
| 49 CreditCard card = cards.get(i); | 49 CreditCard card = cards.get(i); |
| 50 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd
dressId()) | 50 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd
dressId()) |
| 51 ? null : pdm.getProfile(card.getBillingAddressId()); | 51 ? null : pdm.getProfile(card.getBillingAddressId()); |
| 52 |
| 53 if (billingAddress != null |
| 54 && AutofillAddress.checkAddressCompletionStatus(billingAddre
ss) |
| 55 != AutofillAddress.COMPLETE) { |
| 56 billingAddress = null; |
| 57 } |
| 58 |
| 52 instruments.add(new AutofillPaymentInstrument(mContext, mWebContents
, card, | 59 instruments.add(new AutofillPaymentInstrument(mContext, mWebContents
, card, |
| 53 billingAddress)); | 60 billingAddress)); |
| 54 } | 61 } |
| 55 | 62 |
| 56 new Handler().post(new Runnable() { | 63 new Handler().post(new Runnable() { |
| 57 @Override | 64 @Override |
| 58 public void run() { | 65 public void run() { |
| 59 callback.onInstrumentsReady(AutofillPaymentApp.this, instruments
); | 66 callback.onInstrumentsReady(AutofillPaymentApp.this, instruments
); |
| 60 } | 67 } |
| 61 }); | 68 }); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 82 methods.add("generic"); | 89 methods.add("generic"); |
| 83 | 90 |
| 84 return methods; | 91 return methods; |
| 85 } | 92 } |
| 86 | 93 |
| 87 @Override | 94 @Override |
| 88 public String getAppIdentifier() { | 95 public String getAppIdentifier() { |
| 89 return "Chrome_Autofill_Payment_App"; | 96 return "Chrome_Autofill_Payment_App"; |
| 90 } | 97 } |
| 91 } | 98 } |
| OLD | NEW |