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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 * Builds the PaymentRequest service implementation. | 328 * Builds the PaymentRequest service implementation. |
329 * | 329 * |
330 * @param webContents The web contents that have invoked the PaymentRequest
API. | 330 * @param webContents The web contents that have invoked the PaymentRequest
API. |
331 */ | 331 */ |
332 public PaymentRequestImpl(WebContents webContents) { | 332 public PaymentRequestImpl(WebContents webContents) { |
333 assert webContents != null; | 333 assert webContents != null; |
334 | 334 |
335 mWebContents = webContents; | 335 mWebContents = webContents; |
336 | 336 |
337 mMerchantName = webContents.getTitle(); | 337 mMerchantName = webContents.getTitle(); |
338 // The feature is available only in secure context, so it's OK to not sh
ow HTTPS. | 338 mOrigin = |
339 mOrigin = UrlFormatter.formatUrlForSecurityDisplay( | 339 UrlFormatter.formatUrlForSecurityDisplay(mWebContents.getLastCom
mittedUrl(), true); |
340 mWebContents.getLastCommittedUrl(), false); | |
341 mCertificateChain = CertificateChainHelper.getCertificateChain(mWebConte
nts); | 340 mCertificateChain = CertificateChainHelper.getCertificateChain(mWebConte
nts); |
342 | 341 |
343 mApps = new ArrayList<>(); | 342 mApps = new ArrayList<>(); |
344 | 343 |
345 mAddressEditor = new AddressEditor(); | 344 mAddressEditor = new AddressEditor(); |
346 mCardEditor = new CardEditor(mWebContents, mAddressEditor, sObserverForT
est); | 345 mCardEditor = new CardEditor(mWebContents, mAddressEditor, sObserverForT
est); |
347 | 346 |
348 if (sCanMakePaymentQueries == null) sCanMakePaymentQueries = new ArrayMa
p<>(); | 347 if (sCanMakePaymentQueries == null) sCanMakePaymentQueries = new ArrayMa
p<>(); |
349 | 348 |
350 recordSuccessFunnelHistograms("Initiated"); | 349 recordSuccessFunnelHistograms("Initiated"); |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1630 |
1632 /** | 1631 /** |
1633 * The frecency score is calculated according to use count and last use date
. The formula is | 1632 * The frecency score is calculated according to use count and last use date
. The formula is |
1634 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. | 1633 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
1635 */ | 1634 */ |
1636 private static final double getFrecencyScore(int count, long date) { | 1635 private static final double getFrecencyScore(int count, long date) { |
1637 long currentTime = System.currentTimeMillis(); | 1636 long currentTime = System.currentTimeMillis(); |
1638 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); | 1637 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); |
1639 } | 1638 } |
1640 } | 1639 } |
OLD | NEW |