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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java

Issue 2708933003: [Payments] Add timeout to the address_normalizer. (Closed)
Patch Set: Addressed comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
index ef0826e2c614f41cd8c2d3605e9acc50c5043263..74b352f9b70757fa74ffd383eafa2efc67c11e9b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.payments;
import android.content.Context;
-import android.os.Handler;
import android.text.TextUtils;
import android.util.JsonWriter;
@@ -100,8 +99,9 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mIsWaitingForFullCardDetails = true;
// Start the billing address normalization.
- PersonalDataManager.getInstance().normalizeAddress(
- mBillingAddress.getGUID(), AutofillAddress.getCountryCode(mBillingAddress), this);
+ PersonalDataManager.getInstance().normalizeAddress(mBillingAddress.getGUID(),
+ AutofillAddress.getCountryCode(mBillingAddress),
+ PersonalDataManager.getInstance().getNormalizationTimeoutSeconds(), this);
Mathieu 2017/02/22 02:01:31 I don't understand well why this can't be internal
sebsg 2017/02/22 17:04:18 Done.
// Start to get the full card details.
PersonalDataManager.getInstance().getFullCard(mWebContents, mCard, this);
@@ -126,20 +126,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mCallback.onInstrumentDetailsLoadingWithoutUI();
// Wait for the billing address normalization before sending the instrument details.
- if (mIsWaitingForBillingNormalization) {
- // If the normalization is not completed yet, Start a timer to cancel it if it takes too
- // long.
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- onAddressNormalized(null);
- }
- }, PersonalDataManager.getInstance().getNormalizationTimeoutMS());
-
- return;
- } else {
- sendIntrumentDetails();
- }
+ if (!mIsWaitingForBillingNormalization) sendInstrumentDetails();
}
@Override
@@ -151,7 +138,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
if (profile != null) mBillingAddress = profile;
// Wait for the full card details before sending the instrument details.
- if (!mIsWaitingForFullCardDetails) sendIntrumentDetails();
+ if (!mIsWaitingForFullCardDetails) sendInstrumentDetails();
}
@Override
@@ -163,7 +150,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
* Stringify the card details and send the resulting string and the method name to the
* registered callback.
*/
- private void sendIntrumentDetails() {
+ private void sendInstrumentDetails() {
StringWriter stringWriter = new StringWriter();
JsonWriter json = new JsonWriter(stringWriter);
try {

Powered by Google App Engine
This is Rietveld 408576698