| 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.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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 if (mClient == null || mPaymentResponseHelper == null) return; | 1620 if (mClient == null || mPaymentResponseHelper == null) return; |
| 1621 | 1621 |
| 1622 // Record the payment method used to complete the transaction. If the pa
yment method was an | 1622 // Record the payment method used to complete the transaction. If the pa
yment method was an |
| 1623 // Autofill credit card with an identifier, record its use. | 1623 // Autofill credit card with an identifier, record its use. |
| 1624 PaymentOption selectedPaymentMethod = mPaymentMethodsSection.getSelected
Item(); | 1624 PaymentOption selectedPaymentMethod = mPaymentMethodsSection.getSelected
Item(); |
| 1625 if (selectedPaymentMethod instanceof AutofillPaymentInstrument) { | 1625 if (selectedPaymentMethod instanceof AutofillPaymentInstrument) { |
| 1626 if (!selectedPaymentMethod.getIdentifier().isEmpty()) { | 1626 if (!selectedPaymentMethod.getIdentifier().isEmpty()) { |
| 1627 PersonalDataManager.getInstance().recordAndLogCreditCardUse( | 1627 PersonalDataManager.getInstance().recordAndLogCreditCardUse( |
| 1628 selectedPaymentMethod.getIdentifier()); | 1628 selectedPaymentMethod.getIdentifier()); |
| 1629 } | 1629 } |
| 1630 PaymentRequestMetrics.recordSelectedPaymentMethodHistogram( | 1630 mJourneyLogger.setSelectedPaymentMethod(SelectedPaymentMethod.CREDIT
_CARD); |
| 1631 SelectedPaymentMethod.CREDIT_CARD); | |
| 1632 } else if (methodName.equals(ANDROID_PAY_METHOD_NAME) | 1631 } else if (methodName.equals(ANDROID_PAY_METHOD_NAME) |
| 1633 || methodName.equals(PAY_WITH_GOOGLE_METHOD_NAME)) { | 1632 || methodName.equals(PAY_WITH_GOOGLE_METHOD_NAME)) { |
| 1634 PaymentRequestMetrics.recordSelectedPaymentMethodHistogram( | 1633 mJourneyLogger.setSelectedPaymentMethod(SelectedPaymentMethod.ANDROI
D_PAY); |
| 1635 SelectedPaymentMethod.ANDROID_PAY); | |
| 1636 } else { | 1634 } else { |
| 1637 PaymentRequestMetrics.recordSelectedPaymentMethodHistogram( | 1635 mJourneyLogger.setSelectedPaymentMethod(SelectedPaymentMethod.OTHER_
PAYMENT_APP); |
| 1638 SelectedPaymentMethod.OTHER_PAYMENT_APP); | |
| 1639 } | 1636 } |
| 1640 | 1637 |
| 1641 // Showing the payment request UI if we were previously skipping it so t
he loading | 1638 // Showing the payment request UI if we were previously skipping it so t
he loading |
| 1642 // spinner shows up until the merchant notifies that payment was complet
ed. | 1639 // spinner shows up until the merchant notifies that payment was complet
ed. |
| 1643 if (mShouldSkipShowingPaymentRequestUi) mUI.showProcessingMessageAfterUi
Skip(); | 1640 if (mShouldSkipShowingPaymentRequestUi) mUI.showProcessingMessageAfterUi
Skip(); |
| 1644 | 1641 |
| 1645 mJourneyLogger.setEventOccurred(Event.RECEIVED_INSTRUMENT_DETAILS); | 1642 mJourneyLogger.setEventOccurred(Event.RECEIVED_INSTRUMENT_DETAILS); |
| 1646 | 1643 |
| 1647 mPaymentResponseHelper.onInstrumentDetailsReceived(methodName, stringifi
edDetails); | 1644 mPaymentResponseHelper.onInstrumentDetailsReceived(methodName, stringifi
edDetails); |
| 1648 } | 1645 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 | 1808 |
| 1812 /** | 1809 /** |
| 1813 * The frecency score is calculated according to use count and last use date
. The formula is | 1810 * The frecency score is calculated according to use count and last use date
. The formula is |
| 1814 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. | 1811 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
| 1815 */ | 1812 */ |
| 1816 private static final double getFrecencyScore(int count, long date) { | 1813 private static final double getFrecencyScore(int count, long date) { |
| 1817 long currentTime = System.currentTimeMillis(); | 1814 long currentTime = System.currentTimeMillis(); |
| 1818 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); | 1815 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); |
| 1819 } | 1816 } |
| 1820 } | 1817 } |
| OLD | NEW |