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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 2686613003: [Payments] Move address normalization code from android to native. (Closed)
Patch Set: Renamed file and 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 unified diff | Download patch
OLDNEW
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.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 1442
1443 recordSuccessFunnelHistograms("ReceivedInstrumentDetails"); 1443 recordSuccessFunnelHistograms("ReceivedInstrumentDetails");
1444 1444
1445 mPaymentResponseHelper.onInstrumentDetailsReceived(methodName, stringifi edDetails); 1445 mPaymentResponseHelper.onInstrumentDetailsReceived(methodName, stringifi edDetails);
1446 } 1446 }
1447 1447
1448 @Override 1448 @Override
1449 public void onPaymentResponseReady(PaymentResponse response) { 1449 public void onPaymentResponseReady(PaymentResponse response) {
1450 mClient.onPaymentResponse(response); 1450 mClient.onPaymentResponse(response);
1451 mPaymentResponseHelper = null; 1451 mPaymentResponseHelper = null;
1452 PersonalDataManager.getInstance().cancelPendingAddressNormalizations();
1453 } 1452 }
1454 1453
1455 /** 1454 /**
1456 * Called if unable to retrieve instrument details. 1455 * Called if unable to retrieve instrument details.
1457 */ 1456 */
1458 @Override 1457 @Override
1459 public void onInstrumentDetailsError() { 1458 public void onInstrumentDetailsError() {
1460 if (mClient == null) return; 1459 if (mClient == null) return;
1461 mPaymentAppRunning = false; 1460 mPaymentAppRunning = false;
1462 // When skipping UI, any errors/cancel from fetching instrument details should be 1461 // When skipping UI, any errors/cancel from fetching instrument details should be
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1598
1600 /** 1599 /**
1601 * The frecency score is calculated according to use count and last use date . The formula is 1600 * The frecency score is calculated according to use count and last use date . The formula is
1602 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. 1601 * the same as the one used in GetFrecencyScore in autofill_data_model.cc.
1603 */ 1602 */
1604 private static final double getFrecencyScore(int count, long date) { 1603 private static final double getFrecencyScore(int count, long date) {
1605 long currentTime = System.currentTimeMillis(); 1604 long currentTime = System.currentTimeMillis();
1606 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); 1605 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2);
1607 } 1606 }
1608 } 1607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698