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

Side by Side Diff: components/payments/content/android/java/src/org/chromium/components/payments/PaymentManifestDownloader.java

Issue 2645813006: Download web payment manifests. (Closed)
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.components.payments;
6
7 import org.chromium.base.annotations.CalledByNative;
8 import org.chromium.base.annotations.JNINamespace;
9 import org.chromium.content_public.browser.WebContents;
10
11 import java.net.URI;
12
13 /**
14 * See comment in:
15 * components/payments/content/android/payment_manifest_downloader.h
16 */
17 @JNINamespace("payments")
18 public class PaymentManifestDownloader {
19 /** Interface for the callback to invoke when finished downloading. */
20 public interface ManifestDownloadCallback {
21 /**
22 * Called on successful download of a payment method manifest.
23 *
24 * @param contents The successfully downloaded payment method manifest.
25 */
26 @CalledByNative("ManifestDownloadCallback")
27 void onManifestDownloadSuccess(String contents);
28
29 /** Called on failed download of a payment method manifest. */
30 @CalledByNative("ManifestDownloadCallback")
31 void onManifestDownloadFailure();
32 }
33
34 private final WebContents mWebContents;
35
36 /**
37 * Builds the downloader.
38 *
39 * @param webContents The web contents to use as the context for the downloa d. If this goes
40 * away, the download is cancelled.
41 */
42 public PaymentManifestDownloader(WebContents webContents) {
43 mWebContents = webContents;
44 }
45
46 /**
47 * Downloads the manifest file asynchronously.
48 *
49 * @param methodName The payment method name that is a URI with HTTPS scheme .
50 * @param callback The callback to invoke when finished downloading.
51 */
52 public void download(URI methodName, ManifestDownloadCallback callback) {
53 nativeDownloadPaymentManifest(mWebContents, methodName, callback);
54 }
55
56 @CalledByNative
57 private static String getUriString(URI methodName) {
58 return methodName.toString();
59 }
60
61 private static native void nativeDownloadPaymentManifest(
62 WebContents webContents, URI methodName, ManifestDownloadCallback ca llback);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698