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 android.graphics.drawable.Drawable; | |
8 | |
7 import org.chromium.content_public.browser.WebContents; | 9 import org.chromium.content_public.browser.WebContents; |
8 import org.chromium.payments.mojom.PaymentDetailsModifier; | 10 import org.chromium.payments.mojom.PaymentDetailsModifier; |
9 import org.chromium.payments.mojom.PaymentItem; | 11 import org.chromium.payments.mojom.PaymentItem; |
10 import org.chromium.payments.mojom.PaymentMethodData; | 12 import org.chromium.payments.mojom.PaymentMethodData; |
11 | 13 |
12 import java.util.Collections; | 14 import java.util.Collections; |
13 import java.util.HashSet; | 15 import java.util.HashSet; |
14 import java.util.List; | 16 import java.util.List; |
15 import java.util.Map; | 17 import java.util.Map; |
16 import java.util.Set; | 18 import java.util.Set; |
(...skipping 15 matching lines...) Expand all Loading... | |
32 /** | 34 /** |
33 * Build a service worker based payment instrument. | 35 * Build a service worker based payment instrument. |
34 * | 36 * |
35 * @see https://w3c.github.io/webpayments-payment-apps-api/#payment-app-opti ons | 37 * @see https://w3c.github.io/webpayments-payment-apps-api/#payment-app-opti ons |
36 * | 38 * |
37 * @param webContents The web contents where PaymentRequest was invoke d. | 39 * @param webContents The web contents where PaymentRequest was invoke d. |
38 * @param swRegistrationId The registration id of the corresponding service worker payment app. | 40 * @param swRegistrationId The registration id of the corresponding service worker payment app. |
39 * @param instrumentId The unique id of the payment instrument. | 41 * @param instrumentId The unique id of the payment instrument. |
40 * @param label The label of the payment instrument. | 42 * @param label The label of the payment instrument. |
41 * @param methodNames A set of payment method names supported by the p ayment instrument. | 43 * @param methodNames A set of payment method names supported by the p ayment instrument. |
44 * @param icon The drawable icon of the payment instrument. | |
42 */ | 45 */ |
43 public ServiceWorkerPaymentInstrument(WebContents webContents, long swRegist rationId, | 46 public ServiceWorkerPaymentInstrument(WebContents webContents, long swRegist rationId, |
44 String instrumentId, String label, Set<String> methodNames) { | 47 String instrumentId, String label, Set<String> methodNames, Drawable icon) { |
45 super(Long.toString(swRegistrationId) + "#" + instrumentId, label, null /* sublabel */, | 48 super(Long.toString(swRegistrationId) + "#" + instrumentId, label, null /* sublabel */, |
46 null /* icon */); | 49 icon /* icon */); |
please use gerrit instead
2017/06/08 21:34:10
Please remove the clarifying comment /* icon */, b
gogerald1
2017/06/09 14:23:23
Done.
| |
47 mWebContents = webContents; | 50 mWebContents = webContents; |
48 mSWRegistrationId = swRegistrationId; | 51 mSWRegistrationId = swRegistrationId; |
49 mInstrumentId = instrumentId; | 52 mInstrumentId = instrumentId; |
50 mMethodNames = methodNames; | 53 mMethodNames = methodNames; |
51 } | 54 } |
52 | 55 |
53 @Override | 56 @Override |
54 public Set<String> getInstrumentMethodNames() { | 57 public Set<String> getInstrumentMethodNames() { |
55 return Collections.unmodifiableSet(mMethodNames); | 58 return Collections.unmodifiableSet(mMethodNames); |
56 } | 59 } |
57 | 60 |
58 @Override | 61 @Override |
59 public void invokePaymentApp(String id, String merchantName, String origin, String iframeOrigin, | 62 public void invokePaymentApp(String id, String merchantName, String origin, String iframeOrigin, |
60 byte[][] unusedCertificateChain, Map<String, PaymentMethodData> meth odData, | 63 byte[][] unusedCertificateChain, Map<String, PaymentMethodData> meth odData, |
61 PaymentItem total, List<PaymentItem> displayItems, | 64 PaymentItem total, List<PaymentItem> displayItems, |
62 Map<String, PaymentDetailsModifier> modifiers, InstrumentDetailsCall back callback) { | 65 Map<String, PaymentDetailsModifier> modifiers, InstrumentDetailsCall back callback) { |
63 ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mSWRegistra tionId, origin, | 66 ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mSWRegistra tionId, origin, |
64 iframeOrigin, id, new HashSet<>(methodData.values()), total, | 67 iframeOrigin, id, new HashSet<>(methodData.values()), total, |
65 new HashSet<>(modifiers.values()), mInstrumentId, callback); | 68 new HashSet<>(modifiers.values()), mInstrumentId, callback); |
66 } | 69 } |
67 | 70 |
68 @Override | 71 @Override |
69 public void dismissInstrument() {} | 72 public void dismissInstrument() {} |
70 } | 73 } |
OLD | NEW |