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

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

Powered by Google App Engine
This is Rietveld 408576698