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

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

Issue 2859613002: Disable web payments API on blob: and data: schemes. (Closed)
Patch Set: Fix up Android test Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/android/java_sources.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698