| 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 static java.util.Arrays.asList; | 7 import static java.util.Arrays.asList; |
| 8 | 8 |
| 9 import android.os.Handler; | 9 import android.os.Handler; |
| 10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 private InstrumentsCallback mCallback; | 923 private InstrumentsCallback mCallback; |
| 924 | 924 |
| 925 TestPay(List<String> methodNames, int instrumentPresence, int responseSp
eed) { | 925 TestPay(List<String> methodNames, int instrumentPresence, int responseSp
eed) { |
| 926 mMethodNames = methodNames; | 926 mMethodNames = methodNames; |
| 927 mInstrumentPresence = instrumentPresence; | 927 mInstrumentPresence = instrumentPresence; |
| 928 mResponseSpeed = responseSpeed; | 928 mResponseSpeed = responseSpeed; |
| 929 } | 929 } |
| 930 | 930 |
| 931 @Override | 931 @Override |
| 932 public void getInstruments(Map<String, PaymentMethodData> methodData, St
ring origin, | 932 public void getInstruments(Map<String, PaymentMethodData> methodData, St
ring origin, |
| 933 byte[][] certificateChain, InstrumentsCallback instrumentsCallba
ck) { | 933 String iframeOrigin, byte[][] certificateChain, |
| 934 InstrumentsCallback instrumentsCallback) { |
| 934 mCallback = instrumentsCallback; | 935 mCallback = instrumentsCallback; |
| 935 respond(); | 936 respond(); |
| 936 } | 937 } |
| 937 | 938 |
| 938 void respond() { | 939 void respond() { |
| 939 final List<PaymentInstrument> instruments = new ArrayList<>(); | 940 final List<PaymentInstrument> instruments = new ArrayList<>(); |
| 940 if (mInstrumentPresence == HAVE_INSTRUMENTS) { | 941 if (mInstrumentPresence == HAVE_INSTRUMENTS) { |
| 941 for (String methodName : mMethodNames) { | 942 for (String methodName : mMethodNames) { |
| 942 instruments.add( | 943 instruments.add( |
| 943 new TestPayInstrument(getAppIdentifier(), methodName
, methodName)); | 944 new TestPayInstrument(getAppIdentifier(), methodName
, methodName)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 } | 989 } |
| 989 | 990 |
| 990 @Override | 991 @Override |
| 991 public Set<String> getInstrumentMethodNames() { | 992 public Set<String> getInstrumentMethodNames() { |
| 992 Set<String> result = new HashSet<>(); | 993 Set<String> result = new HashSet<>(); |
| 993 result.add(mMethodName); | 994 result.add(mMethodName); |
| 994 return result; | 995 return result; |
| 995 } | 996 } |
| 996 | 997 |
| 997 @Override | 998 @Override |
| 998 public void invokePaymentApp(String merchantName, String origin, byte[][
] certificateChain, | 999 public void invokePaymentApp(String merchantName, String origin, String
iframeOrigin, |
| 999 Map<String, PaymentMethodData> methodData, PaymentItem total, | 1000 byte[][] certificateChain, Map<String, PaymentMethodData> method
Data, |
| 1000 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi
er> modifiers, | 1001 PaymentItem total, List<PaymentItem> displayItems, |
| 1002 Map<String, PaymentDetailsModifier> modifiers, |
| 1001 InstrumentDetailsCallback detailsCallback) { | 1003 InstrumentDetailsCallback detailsCallback) { |
| 1002 detailsCallback.onInstrumentDetailsReady( | 1004 detailsCallback.onInstrumentDetailsReady( |
| 1003 mMethodName, "{\"transaction\": 1337}"); | 1005 mMethodName, "{\"transaction\": 1337}"); |
| 1004 } | 1006 } |
| 1005 | 1007 |
| 1006 @Override | 1008 @Override |
| 1007 public void dismissInstrument() {} | 1009 public void dismissInstrument() {} |
| 1008 } | 1010 } |
| 1009 } | 1011 } |
| OLD | NEW |