| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 disconnectFromClientWithDebugMessage("Not in a secure context"); | 417 disconnectFromClientWithDebugMessage("Not in a secure context"); |
| 418 return; | 418 return; |
| 419 } | 419 } |
| 420 | 420 |
| 421 mRequestShipping = options != null && options.requestShipping; | 421 mRequestShipping = options != null && options.requestShipping; |
| 422 mRequestPayerName = options != null && options.requestPayerName; | 422 mRequestPayerName = options != null && options.requestPayerName; |
| 423 mRequestPayerPhone = options != null && options.requestPayerPhone; | 423 mRequestPayerPhone = options != null && options.requestPayerPhone; |
| 424 mRequestPayerEmail = options != null && options.requestPayerEmail; | 424 mRequestPayerEmail = options != null && options.requestPayerEmail; |
| 425 mShippingType = options == null ? PaymentShippingType.SHIPPING : options
.shippingType; | 425 mShippingType = options == null ? PaymentShippingType.SHIPPING : options
.shippingType; |
| 426 | 426 |
| 427 if (!OriginSecurityChecker.isSchemeCryptographic(mWebContents.getLastCom
mittedUrl()) |
| 428 && !OriginSecurityChecker.isOriginLocalhostOrFile( |
| 429 mWebContents.getLastCommittedUrl())) { |
| 430 Log.d(TAG, "Only localhost, file://, and cryptographic scheme origin
s allowed"); |
| 431 // Don't show any UI. Resolve .canMakePayment() with "false". Reject
.show() with |
| 432 // "NotSupportedError". |
| 433 onAllPaymentAppsCreated(); |
| 434 return; |
| 435 } |
| 436 |
| 427 PaymentRequestMetrics.recordRequestedInformationHistogram( | 437 PaymentRequestMetrics.recordRequestedInformationHistogram( |
| 428 mRequestPayerEmail, mRequestPayerPhone, mRequestShipping, mReque
stPayerName); | 438 mRequestPayerEmail, mRequestPayerPhone, mRequestShipping, mReque
stPayerName); |
| 429 | 439 |
| 430 if (OriginSecurityChecker.isSchemeCryptographic(mWebContents.getLastComm
ittedUrl()) | 440 if (OriginSecurityChecker.isSchemeCryptographic(mWebContents.getLastComm
ittedUrl()) |
| 431 && !SslValidityChecker.isSslCertificateValid(mWebContents)) { | 441 && !SslValidityChecker.isSslCertificateValid(mWebContents)) { |
| 432 Log.d(TAG, "SSL certificate is not valid"); | 442 Log.d(TAG, "SSL certificate is not valid"); |
| 433 // Don't show any UI. Resolve .canMakePayment() with "false". Reject
.show() with | 443 // Don't show any UI. Resolve .canMakePayment() with "false". Reject
.show() with |
| 434 // "NotSupportedError". | 444 // "NotSupportedError". |
| 435 onAllPaymentAppsCreated(); | 445 onAllPaymentAppsCreated(); |
| 436 return; | 446 return; |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1802 | 1812 |
| 1803 /** | 1813 /** |
| 1804 * The frecency score is calculated according to use count and last use date
. The formula is | 1814 * The frecency score is calculated according to use count and last use date
. The formula is |
| 1805 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. | 1815 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
| 1806 */ | 1816 */ |
| 1807 private static final double getFrecencyScore(int count, long date) { | 1817 private static final double getFrecencyScore(int count, long date) { |
| 1808 long currentTime = System.currentTimeMillis(); | 1818 long currentTime = System.currentTimeMillis(); |
| 1809 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); | 1819 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat
h.log(count + 2); |
| 1810 } | 1820 } |
| 1811 } | 1821 } |
| OLD | NEW |