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

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

Issue 2692023002: Make PaymentRequestImpl work with RenderFrameHost (Closed)
Patch Set: Address review comment Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
index fa2b40a2a3a37f655aaad08d427451d2c4dc9d3e..bc8f617aa6c64756986dd2d1370fc75a1f6e40df 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -47,7 +47,9 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.components.payments.CurrencyFormatter;
import org.chromium.components.payments.PaymentValidator;
import org.chromium.components.url_formatter.UrlFormatter;
+import org.chromium.content_public.browser.RenderFrameHost;
import org.chromium.content_public.browser.WebContents;
+import org.chromium.content_public.browser.WebContentsStatics;
import org.chromium.mojo.system.MojoException;
import org.chromium.payments.mojom.CanMakePaymentQueryResult;
import org.chromium.payments.mojom.PaymentComplete;
@@ -246,6 +248,7 @@ public class PaymentRequestImpl
};
private final Handler mHandler = new Handler();
+ private final RenderFrameHost mRenderFrameHost;
private final WebContents mWebContents;
private final String mSchemelessOriginForPaymentApp;
private final String mOriginForDisplay;
@@ -347,10 +350,11 @@ public class PaymentRequestImpl
*
* @param webContents The web contents that have invoked the PaymentRequest API.
*/
- public PaymentRequestImpl(WebContents webContents) {
- assert webContents != null;
+ public PaymentRequestImpl(RenderFrameHost renderFrameHost) {
+ assert renderFrameHost != null;
- mWebContents = webContents;
+ mRenderFrameHost = renderFrameHost;
+ mWebContents = WebContentsStatics.fromRenderFrameHost(renderFrameHost);
mSchemelessOriginForPaymentApp = UrlFormatter.formatUrlForSecurityDisplay(
mWebContents.getLastCommittedUrl(), false /* omit scheme for payment apps. */);
@@ -358,7 +362,8 @@ public class PaymentRequestImpl
mOriginForDisplay = UrlFormatter.formatUrlForSecurityDisplay(
mWebContents.getLastCommittedUrl(), true /* include scheme in display */);
- mMerchantName = webContents.getTitle();
+ mMerchantName = mWebContents.getTitle();
+
mCertificateChain = CertificateChainHelper.getCertificateChain(mWebContents);
mApps = new ArrayList<>();

Powered by Google App Engine
This is Rietveld 408576698