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

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

Issue 2645813006: Download web payment manifests. (Closed)
Patch Set: At most INT_MAX sections in manifest and fingperints in section Created 3 years, 10 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/PaymentManifestDownloader.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentManifestDownloader.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentManifestDownloader.java
new file mode 100644
index 0000000000000000000000000000000000000000..12a14bc4044fdb7cfe7f782c5c2293882f4bae0b
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentManifestDownloader.java
@@ -0,0 +1,63 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.content_public.browser.WebContents;
+
+import java.net.URI;
+
+/**
+ * See comment in:
+ * components/payments/content/android/payment_manifest_downloader.h
+ */
+@JNINamespace("payments")
+public class PaymentManifestDownloader {
+ /** Interface for the callback to invoke when finished downloading. */
+ public interface ManifestDownloadCallback {
+ /**
+ * Called on successful download of a payment method manifest.
+ *
+ * @param contents The successfully downloaded payment method manifest.
+ */
+ @CalledByNative("ManifestDownloadCallback")
+ void onManifestDownloadSuccess(String contents);
+
+ /** Called on failed download of a payment method manifest. */
+ @CalledByNative("ManifestDownloadCallback")
+ void onManifestDownloadFailure();
+ }
+
+ private final WebContents mWebContents;
+
+ /**
+ * Builds the downloader.
+ *
+ * @param webContents The web contents to use as the context for the download. If this goes
+ * away, the download is cancelled.
+ */
+ public PaymentManifestDownloader(WebContents webContents) {
+ mWebContents = webContents;
+ }
+
+ /**
+ * Downloads the manifest file asynchronously.
+ *
+ * @param methodName The payment method name that is a URI with HTTPS scheme.
+ * @param callback The callback to invoke when finished downloading.
+ */
+ public void download(URI methodName, ManifestDownloadCallback callback) {
+ nativeDownloadPaymentManifest(mWebContents, methodName, callback);
+ }
+
+ @CalledByNative
+ private static String getUriString(URI methodName) {
+ return methodName.toString();
+ }
+
+ private static native void nativeDownloadPaymentManifest(
+ WebContents webContents, URI methodName, ManifestDownloadCallback callback);
+}

Powered by Google App Engine
This is Rietveld 408576698