OLD | NEW |
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 org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
8 import org.chromium.base.annotations.SuppressFBWarnings; | 8 import org.chromium.base.annotations.SuppressFBWarnings; |
9 import org.chromium.content_public.browser.WebContents; | 9 import org.chromium.content_public.browser.WebContents; |
10 import org.chromium.payments.mojom.PaymentDetailsModifier; | 10 import org.chromium.payments.mojom.PaymentDetailsModifier; |
(...skipping 15 matching lines...) Expand all Loading... |
26 public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
ppFactoryAddition { | 26 public class ServiceWorkerPaymentAppBridge implements PaymentAppFactory.PaymentA
ppFactoryAddition { |
27 @Override | 27 @Override |
28 public void create(WebContents webContents, Set<String> methodNames, | 28 public void create(WebContents webContents, Set<String> methodNames, |
29 PaymentAppFactory.PaymentAppCreatedCallback callback) { | 29 PaymentAppFactory.PaymentAppCreatedCallback callback) { |
30 nativeGetAllPaymentApps(webContents, callback); | 30 nativeGetAllPaymentApps(webContents, callback); |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Invoke a payment app with a given option and matching method data. | 34 * Invoke a payment app with a given option and matching method data. |
35 * | 35 * |
36 * @param webContents The web contents that invoked PaymentRequest. | 36 * @param webContents The web contents that invoked PaymentRequest. |
37 * @param registrationId The service worker registration ID of the Payment A
pp. | 37 * @param registrationId The service worker registration ID of the Payment
App. |
38 * @param optionId The ID of the PaymentOption that was selected by th
e user. | 38 * @param origin The origin of this merchant. |
39 * @param methodData The PaymentMethodData objects that are relevant for
this payment | 39 * @param iframeOrigin The origin of the iframe that invoked PaymentRequ
est. Same as origin |
40 * app. | 40 * if PaymentRequest was not invoked from inside an
iframe. |
41 * @param total The PaymentItem that represents the total cost of t
he payment. | 41 * @param paymentRequestId The unique identifier of the PaymentRequest. |
42 * @param modifiers Payment method specific modifiers to the payment it
ems and the total. | 42 * @param methodData The PaymentMethodData objects that are relevant f
or this payment |
43 * @param callback Called after the payment app is finished running. | 43 * app. |
| 44 * @param total The PaymentItem that represents the total cost of
the payment. |
| 45 * @param modifiers Payment method specific modifiers to the payment
items and the total. |
| 46 * @param instrumentId The ID of the PaymentInstrument that was selected
by the user. |
| 47 * @param callback Called after the payment app is finished running. |
44 */ | 48 */ |
45 public static void invokePaymentApp(WebContents webContents, long registrati
onId, | 49 public static void invokePaymentApp(WebContents webContents, long registrati
onId, String origin, |
46 String optionId, String origin, String unusedIframeOrigin, | 50 String iframeOrigin, String paymentRequestId, Set<PaymentMethodData>
methodData, |
47 Set<PaymentMethodData> methodData, PaymentItem total, List<PaymentIt
em> displayItems, | 51 PaymentItem total, Set<PaymentDetailsModifier> modifiers, String ins
trumentId, |
48 Set<PaymentDetailsModifier> modifiers, | |
49 PaymentInstrument.InstrumentDetailsCallback callback) { | 52 PaymentInstrument.InstrumentDetailsCallback callback) { |
50 nativeInvokePaymentApp(webContents, registrationId, optionId, origin, | 53 nativeInvokePaymentApp(webContents, registrationId, origin, iframeOrigin
, paymentRequestId, |
51 methodData.toArray(new PaymentMethodData[0]), total, | 54 methodData.toArray(new PaymentMethodData[0]), total, |
52 modifiers.toArray(new PaymentDetailsModifier[0]), callback); | 55 modifiers.toArray(new PaymentDetailsModifier[0]), instrumentId,
callback); |
53 } | 56 } |
54 | 57 |
55 @CalledByNative | 58 @CalledByNative |
56 private static List<PaymentInstrument> createInstrumentList() { | 59 private static List<PaymentInstrument> createInstrumentList() { |
57 return new ArrayList<PaymentInstrument>(); | 60 return new ArrayList<PaymentInstrument>(); |
58 } | 61 } |
59 | 62 |
60 @CalledByNative | 63 @CalledByNative |
61 private static void addInstrument(List<PaymentInstrument> instruments, WebCo
ntents webContents, | 64 private static void addInstrument(List<PaymentInstrument> instruments, WebCo
ntents webContents, |
62 long swRegistrationId, String instrumentId, String label, String[] m
ethodNameArray) { | 65 long swRegistrationId, String instrumentId, String label, String[] m
ethodNameArray) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 * has been resolved. | 138 * has been resolved. |
136 */ | 139 */ |
137 private static native void nativeGetAllPaymentApps(WebContents webContents,
Object callback); | 140 private static native void nativeGetAllPaymentApps(WebContents webContents,
Object callback); |
138 | 141 |
139 /* | 142 /* |
140 * TODO(tommyt): crbug.com/505554. Change the |callback| parameter below to | 143 * TODO(tommyt): crbug.com/505554. Change the |callback| parameter below to |
141 * be of type PaymentInstrument.InstrumentDetailsCallback, once this JNI bug | 144 * be of type PaymentInstrument.InstrumentDetailsCallback, once this JNI bug |
142 * has been resolved. | 145 * has been resolved. |
143 */ | 146 */ |
144 private static native void nativeInvokePaymentApp(WebContents webContents, l
ong registrationId, | 147 private static native void nativeInvokePaymentApp(WebContents webContents, l
ong registrationId, |
145 String optionId, String origin, PaymentMethodData[] methodData, Paym
entItem total, | 148 String topLevelOrigin, String paymentRequestOrigin, String paymentRe
questId, |
146 PaymentDetailsModifier[] modifiers, Object callback); | 149 PaymentMethodData[] methodData, PaymentItem total, PaymentDetailsMod
ifier[] modifiers, |
| 150 String instrumentKey, Object callback); |
147 } | 151 } |
OLD | NEW |