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.app.Activity; | 7 import android.app.Activity; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 23 matching lines...) Expand all Loading... | |
34 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; | 34 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; |
35 import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; | 35 import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; |
36 import org.chromium.chrome.browser.tabmodel.TabModel; | 36 import org.chromium.chrome.browser.tabmodel.TabModel; |
37 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; | 37 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; |
38 import org.chromium.chrome.browser.tabmodel.TabModelObserver; | 38 import org.chromium.chrome.browser.tabmodel.TabModelObserver; |
39 import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; | 39 import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; |
40 import org.chromium.components.safejson.JsonSanitizer; | 40 import org.chromium.components.safejson.JsonSanitizer; |
41 import org.chromium.components.url_formatter.UrlFormatter; | 41 import org.chromium.components.url_formatter.UrlFormatter; |
42 import org.chromium.content_public.browser.WebContents; | 42 import org.chromium.content_public.browser.WebContents; |
43 import org.chromium.mojo.system.MojoException; | 43 import org.chromium.mojo.system.MojoException; |
44 import org.chromium.payments.mojom.ActivePaymentQueryResult; | |
44 import org.chromium.payments.mojom.PaymentComplete; | 45 import org.chromium.payments.mojom.PaymentComplete; |
45 import org.chromium.payments.mojom.PaymentDetails; | 46 import org.chromium.payments.mojom.PaymentDetails; |
46 import org.chromium.payments.mojom.PaymentErrorReason; | 47 import org.chromium.payments.mojom.PaymentErrorReason; |
47 import org.chromium.payments.mojom.PaymentItem; | 48 import org.chromium.payments.mojom.PaymentItem; |
48 import org.chromium.payments.mojom.PaymentMethodData; | 49 import org.chromium.payments.mojom.PaymentMethodData; |
49 import org.chromium.payments.mojom.PaymentOptions; | 50 import org.chromium.payments.mojom.PaymentOptions; |
50 import org.chromium.payments.mojom.PaymentRequest; | 51 import org.chromium.payments.mojom.PaymentRequest; |
51 import org.chromium.payments.mojom.PaymentRequestClient; | 52 import org.chromium.payments.mojom.PaymentRequestClient; |
52 import org.chromium.payments.mojom.PaymentResponse; | 53 import org.chromium.payments.mojom.PaymentResponse; |
53 import org.chromium.payments.mojom.PaymentShippingOption; | 54 import org.chromium.payments.mojom.PaymentShippingOption; |
(...skipping 12 matching lines...) Expand all Loading... | |
66 import java.util.Set; | 67 import java.util.Set; |
67 | 68 |
68 /** | 69 /** |
69 * Android implementation of the PaymentRequest service defined in | 70 * Android implementation of the PaymentRequest service defined in |
70 * components/payments/payment_request.mojom. | 71 * components/payments/payment_request.mojom. |
71 */ | 72 */ |
72 public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie nt, | 73 public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie nt, |
73 PaymentApp.InstrumentsCallback, PaymentInstrument.InstrumentDetailsCallb ack, | 74 PaymentApp.InstrumentsCallback, PaymentInstrument.InstrumentDetailsCallb ack, |
74 PaymentResponseHelper.PaymentResponseRequesterDelegate { | 75 PaymentResponseHelper.PaymentResponseRequesterDelegate { |
75 /** | 76 /** |
76 * Observer to be notified when PaymentRequest UI has been dismissed. | 77 * Observer to be notified when PaymentRequest UI has been displayed or dism issed. |
77 */ | 78 */ |
78 public interface PaymentRequestDismissObserver { | 79 public interface PaymentRequestDisplayObserver { |
80 /** | |
81 * Called when PaymentRequest UI has been displayed. | |
82 */ | |
83 void onPaymentRequestDisplayed(); | |
84 | |
79 /** | 85 /** |
80 * Called when PaymentRequest UI has been dismissed. | 86 * Called when PaymentRequest UI has been dismissed. |
81 */ | 87 */ |
82 void onPaymentRequestDismissed(); | 88 void onPaymentRequestDismissed(); |
83 } | 89 } |
84 | 90 |
85 /** | 91 /** |
86 * A test-only observer for the PaymentRequest service implementation. | 92 * A test-only observer for the PaymentRequest service implementation. |
87 */ | 93 */ |
88 public interface PaymentRequestServiceObserverForTest { | 94 public interface PaymentRequestServiceObserverForTest { |
(...skipping 15 matching lines...) Expand all Loading... | |
104 | 110 |
105 /** | 111 /** |
106 * Called when a show request failed. This can happen when: | 112 * Called when a show request failed. This can happen when: |
107 * <ul> | 113 * <ul> |
108 * <li>The merchant requests only unsupported payment methods.</li> | 114 * <li>The merchant requests only unsupported payment methods.</li> |
109 * <li>The merchant requests only payment methods that don't have inst ruments and are not | 115 * <li>The merchant requests only payment methods that don't have inst ruments and are not |
110 * able to add instruments from PaymentRequest UI.</li> | 116 * able to add instruments from PaymentRequest UI.</li> |
111 * </ul> | 117 * </ul> |
112 */ | 118 */ |
113 void onPaymentRequestServiceShowFailed(); | 119 void onPaymentRequestServiceShowFailed(); |
120 | |
121 /** | |
122 * Called when the canMakeActivePayment() request has been responded. | |
123 */ | |
124 void onPaymentRequestServiceActivePaymentQueryResponded(); | |
114 } | 125 } |
115 | 126 |
116 private static final String TAG = "cr_PaymentRequest"; | 127 private static final String TAG = "cr_PaymentRequest"; |
117 private static final String ANDROID_PAY_METHOD_NAME = "https://android.com/p ay"; | 128 private static final String ANDROID_PAY_METHOD_NAME = "https://android.com/p ay"; |
118 private static final int SUGGESTIONS_LIMIT = 4; | 129 private static final int SUGGESTIONS_LIMIT = 4; |
119 private static final Comparator<Completable> COMPLETENESS_COMPARATOR = | 130 private static final Comparator<Completable> COMPLETENESS_COMPARATOR = |
120 new Comparator<Completable>() { | 131 new Comparator<Completable>() { |
121 @Override | 132 @Override |
122 public int compare(Completable a, Completable b) { | 133 public int compare(Completable a, Completable b) { |
123 return (b.isComplete() ? 1 : 0) - (a.isComplete() ? 1 : 0); | 134 return (b.isComplete() ? 1 : 0) - (a.isComplete() ? 1 : 0); |
124 } | 135 } |
125 }; | 136 }; |
126 | 137 |
138 /** Every origin can call canMakeActivePayment() every 30 minutes. */ | |
139 private static final int CAN_MAKE_ACTIVE_PAYMENT_QUERY_PERIOD_MS = 30 * 60 * 1000; | |
140 | |
127 private static PaymentRequestServiceObserverForTest sObserverForTest; | 141 private static PaymentRequestServiceObserverForTest sObserverForTest; |
128 | 142 |
143 /** | |
144 * In-memory mapping of the origins of websites that have recently called ca nMakeActivePayment() | |
145 * to the list of the payment methods that were been queried. Used for throt tling the usage of | |
146 * this call. The user can clear the list by restarting the browser. | |
147 */ | |
148 private static Map<String, Set<String>> sCanMakeActivePaymentQueries; | |
149 | |
129 /** Monitors changes in the TabModelSelector. */ | 150 /** Monitors changes in the TabModelSelector. */ |
130 private final TabModelSelectorObserver mSelectorObserver = new EmptyTabModel SelectorObserver() { | 151 private final TabModelSelectorObserver mSelectorObserver = new EmptyTabModel SelectorObserver() { |
131 @Override | 152 @Override |
132 public void onTabModelSelected(TabModel newModel, TabModel oldModel) { | 153 public void onTabModelSelected(TabModel newModel, TabModel oldModel) { |
133 onDismiss(); | 154 onDismiss(); |
134 } | 155 } |
135 }; | 156 }; |
136 | 157 |
137 /** Monitors changes in the current TabModel. */ | 158 /** Monitors changes in the current TabModel. */ |
138 private final TabModelObserver mTabModelObserver = new EmptyTabModelObserver () { | 159 private final TabModelObserver mTabModelObserver = new EmptyTabModelObserver () { |
139 @Override | 160 @Override |
140 public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { | 161 public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { |
141 if (tab == null || tab.getId() != lastId) onDismiss(); | 162 if (tab == null || tab.getId() != lastId) onDismiss(); |
142 } | 163 } |
143 }; | 164 }; |
144 | 165 |
145 private final Handler mHandler = new Handler(); | 166 private final Handler mHandler = new Handler(); |
146 private final ChromeActivity mContext; | 167 private final ChromeActivity mContext; |
147 private final PaymentRequestDismissObserver mDismissObserver; | 168 private final PaymentRequestDisplayObserver mDisplayObserver; |
148 private final String mMerchantName; | 169 private final String mMerchantName; |
149 private final String mOrigin; | 170 private final String mOrigin; |
150 private final List<PaymentApp> mApps; | 171 private final List<PaymentApp> mApps; |
151 private final AddressEditor mAddressEditor; | 172 private final AddressEditor mAddressEditor; |
152 private final CardEditor mCardEditor; | 173 private final CardEditor mCardEditor; |
153 private final PaymentRequestJourneyLogger mJourneyLogger = new PaymentReques tJourneyLogger(); | 174 private final PaymentRequestJourneyLogger mJourneyLogger = new PaymentReques tJourneyLogger(); |
154 | 175 |
155 private Bitmap mFavicon; | 176 private Bitmap mFavicon; |
156 private PaymentRequestClient mClient; | 177 private PaymentRequestClient mClient; |
157 | 178 |
(...skipping 27 matching lines...) Expand all Loading... | |
185 private List<PaymentApp> mPendingApps; | 206 private List<PaymentApp> mPendingApps; |
186 private List<PaymentInstrument> mPendingInstruments; | 207 private List<PaymentInstrument> mPendingInstruments; |
187 private List<PaymentInstrument> mPendingAutofillInstruments; | 208 private List<PaymentInstrument> mPendingAutofillInstruments; |
188 private SectionInformation mPaymentMethodsSection; | 209 private SectionInformation mPaymentMethodsSection; |
189 private PaymentRequestUI mUI; | 210 private PaymentRequestUI mUI; |
190 private Callback<PaymentInformation> mPaymentInformationCallback; | 211 private Callback<PaymentInformation> mPaymentInformationCallback; |
191 private boolean mPaymentAppRunning; | 212 private boolean mPaymentAppRunning; |
192 private boolean mMerchantSupportsAutofillPaymentInstruments; | 213 private boolean mMerchantSupportsAutofillPaymentInstruments; |
193 private ContactEditor mContactEditor; | 214 private ContactEditor mContactEditor; |
194 private boolean mHasRecordedAbortReason; | 215 private boolean mHasRecordedAbortReason; |
216 private boolean mQueriedCanMakeActivePayment; | |
195 | 217 |
196 /** True if any of the requested payment methods are supported. */ | 218 /** True if any of the requested payment methods are supported. */ |
197 private boolean mArePaymentMethodsSupported; | 219 private boolean mArePaymentMethodsSupported; |
198 | 220 |
199 /** True if show() was called. */ | 221 /** True if show() was called. */ |
200 private boolean mIsShowing; | 222 private boolean mIsShowing; |
201 | 223 |
202 /** The helper to create and fill the response to send to the merchant. */ | 224 /** The helper to create and fill the response to send to the merchant. */ |
203 private PaymentResponseHelper mPaymentResponseHelper; | 225 private PaymentResponseHelper mPaymentResponseHelper; |
204 | 226 |
205 /** | 227 /** |
206 * Builds the PaymentRequest service implementation. | 228 * Builds the PaymentRequest service implementation. |
207 * | 229 * |
208 * @param context The context where PaymentRequest has been invoked. | 230 * @param context The context where PaymentRequest has been invoked. |
209 * @param webContents The web contents that have invoked the PaymentRequ est API. | 231 * @param webContents The web contents that have invoked the PaymentRequ est API. |
210 * @param dismissObserver The observer to notify when PaymentRequest UI has been dismissed. | 232 * @param displayObserver The observer to notify when PaymentRequest UI has been displayed or |
233 * dismissed. | |
211 */ | 234 */ |
212 public PaymentRequestImpl(Activity context, WebContents webContents, | 235 public PaymentRequestImpl(Activity context, WebContents webContents, |
213 PaymentRequestDismissObserver dismissObserver) { | 236 PaymentRequestDisplayObserver displayObserver) { |
214 assert context != null; | 237 assert context != null; |
215 assert webContents != null; | 238 assert webContents != null; |
216 assert dismissObserver != null; | 239 assert displayObserver != null; |
217 | 240 |
218 assert context instanceof ChromeActivity; | 241 assert context instanceof ChromeActivity; |
219 mContext = (ChromeActivity) context; | 242 mContext = (ChromeActivity) context; |
220 | 243 |
221 mDismissObserver = dismissObserver; | 244 mDisplayObserver = displayObserver; |
222 mMerchantName = webContents.getTitle(); | 245 mMerchantName = webContents.getTitle(); |
223 // The feature is available only in secure context, so it's OK to not sh ow HTTPS. | 246 // The feature is available only in secure context, so it's OK to not sh ow HTTPS. |
224 mOrigin = UrlFormatter.formatUrlForSecurityDisplay(webContents.getVisibl eUrl(), false); | 247 mOrigin = UrlFormatter.formatUrlForSecurityDisplay(webContents.getVisibl eUrl(), false); |
225 | 248 |
226 final FaviconHelper faviconHelper = new FaviconHelper(); | 249 final FaviconHelper faviconHelper = new FaviconHelper(); |
227 faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), | 250 faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), |
228 webContents.getVisibleUrl(), | 251 webContents.getVisibleUrl(), |
229 mContext.getResources().getDimensionPixelSize(R.dimen.payments_f avicon_size), | 252 mContext.getResources().getDimensionPixelSize(R.dimen.payments_f avicon_size), |
230 new FaviconHelper.FaviconImageCallback() { | 253 new FaviconHelper.FaviconImageCallback() { |
231 @Override | 254 @Override |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 mIsShowing = true; | 435 mIsShowing = true; |
413 if (disconnectIfNoPaymentMethodsSupported()) return; | 436 if (disconnectIfNoPaymentMethodsSupported()) return; |
414 | 437 |
415 // Catch any time the user switches tabs. Because the dialog is modal, a user shouldn't be | 438 // Catch any time the user switches tabs. Because the dialog is modal, a user shouldn't be |
416 // allowed to switch tabs, which can happen if the user receives an exte rnal Intent. | 439 // allowed to switch tabs, which can happen if the user receives an exte rnal Intent. |
417 mContext.getTabModelSelector().addObserver(mSelectorObserver); | 440 mContext.getTabModelSelector().addObserver(mSelectorObserver); |
418 mContext.getCurrentTabModel().addObserver(mTabModelObserver); | 441 mContext.getCurrentTabModel().addObserver(mTabModelObserver); |
419 | 442 |
420 mUI.show(); | 443 mUI.show(); |
421 recordSuccessFunnelHistograms("Shown"); | 444 recordSuccessFunnelHistograms("Shown"); |
445 | |
446 mDisplayObserver.onPaymentRequestDisplayed(); | |
422 } | 447 } |
423 | 448 |
424 private static Map<String, JSONObject> getValidatedMethodData( | 449 private static Map<String, JSONObject> getValidatedMethodData( |
425 PaymentMethodData[] methodData, CardEditor paymentMethodsCollector) { | 450 PaymentMethodData[] methodData, CardEditor paymentMethodsCollector) { |
426 // Payment methodData are required. | 451 // Payment methodData are required. |
427 if (methodData == null || methodData.length == 0) return null; | 452 if (methodData == null || methodData.length == 0) return null; |
428 Map<String, JSONObject> result = new HashMap<>(); | 453 Map<String, JSONObject> result = new HashMap<>(); |
429 for (int i = 0; i < methodData.length; i++) { | 454 for (int i = 0; i < methodData.length; i++) { |
430 JSONObject data = null; | 455 JSONObject data = null; |
431 if (!TextUtils.isEmpty(methodData[i].stringifiedData)) { | 456 if (!TextUtils.isEmpty(methodData[i].stringifiedData)) { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 * Called when the merchant website has processed the payment. | 925 * Called when the merchant website has processed the payment. |
901 */ | 926 */ |
902 @Override | 927 @Override |
903 public void complete(int result) { | 928 public void complete(int result) { |
904 if (mClient == null) return; | 929 if (mClient == null) return; |
905 recordSuccessFunnelHistograms("Completed"); | 930 recordSuccessFunnelHistograms("Completed"); |
906 closeUI(PaymentComplete.FAIL != result); | 931 closeUI(PaymentComplete.FAIL != result); |
907 } | 932 } |
908 | 933 |
909 /** | 934 /** |
935 * Called by the merchant website to check if the user has complete payment instruments. | |
936 */ | |
937 @Override | |
938 public void canMakeActivePayment() { | |
939 if (mClient == null) return; | |
940 | |
941 if (sCanMakeActivePaymentQueries == null) sCanMakeActivePaymentQueries = new HashMap<>(); | |
Ian Wen
2016/11/10 20:21:50
Optional comment:
You might want to consider usin
please use gerrit instead
2016/11/10 21:56:38
Done.
| |
942 | |
943 if (sCanMakeActivePaymentQueries.containsKey(mOrigin)) { | |
944 if (!mMethodData.keySet().equals(sCanMakeActivePaymentQueries.get(mO rigin))) { | |
945 mClient.onCanMakeActivePayment(ActivePaymentQueryResult.QUERY_QU OTA_EXCEEDED); | |
946 if (sObserverForTest != null) { | |
947 sObserverForTest.onPaymentRequestServiceActivePaymentQueryRe sponded(); | |
948 } | |
949 return; | |
950 } | |
951 } else { | |
952 sCanMakeActivePaymentQueries.put(mOrigin, mMethodData.keySet()); | |
953 } | |
954 | |
955 mHandler.postDelayed(new Runnable() { | |
956 @Override | |
957 public void run() { | |
958 sCanMakeActivePaymentQueries.remove(mOrigin); | |
959 } | |
960 }, CAN_MAKE_ACTIVE_PAYMENT_QUERY_PERIOD_MS); | |
961 | |
962 if (!mPendingApps.isEmpty() || !mPendingInstruments.isEmpty()) { | |
963 mQueriedCanMakeActivePayment = true; | |
964 } else { | |
965 mClient.onCanMakeActivePayment(mPaymentMethodsSection == null | |
966 || mPaymentMethodsSection.getSelectedItem() == null | |
967 ? ActivePaymentQueryResult.CANNOT_MAKE_ACTIVE_PAYMEN T | |
968 : ActivePaymentQueryResult.CAN_MAKE_ACTIVE_PAYMENT); | |
969 if (sObserverForTest != null) { | |
970 sObserverForTest.onPaymentRequestServiceActivePaymentQueryRespon ded(); | |
971 } | |
972 } | |
973 } | |
974 | |
975 /** | |
910 * Called when the renderer closes the Mojo connection. | 976 * Called when the renderer closes the Mojo connection. |
911 */ | 977 */ |
912 @Override | 978 @Override |
913 public void close() { | 979 public void close() { |
914 if (mClient == null) return; | 980 if (mClient == null) return; |
915 closeClient(); | 981 closeClient(); |
916 closeUI(true); | 982 closeUI(true); |
917 recordAbortReasonHistogram(PaymentRequestMetrics.ABORT_REASON_MOJO_RENDE RER_CLOSING); | 983 recordAbortReasonHistogram(PaymentRequestMetrics.ABORT_REASON_MOJO_RENDE RER_CLOSING); |
918 } | 984 } |
919 | 985 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 // Pre-select the first instrument on the list, if it is complete. | 1052 // Pre-select the first instrument on the list, if it is complete. |
987 int selection = SectionInformation.NO_SELECTION; | 1053 int selection = SectionInformation.NO_SELECTION; |
988 if (!mPendingInstruments.isEmpty()) { | 1054 if (!mPendingInstruments.isEmpty()) { |
989 PaymentInstrument first = mPendingInstruments.get(0); | 1055 PaymentInstrument first = mPendingInstruments.get(0); |
990 if (!(first instanceof AutofillPaymentInstrument) | 1056 if (!(first instanceof AutofillPaymentInstrument) |
991 || ((AutofillPaymentInstrument) first).isComplete()) { | 1057 || ((AutofillPaymentInstrument) first).isComplete()) { |
992 selection = 0; | 1058 selection = 0; |
993 } | 1059 } |
994 } | 1060 } |
995 | 1061 |
1062 if (mQueriedCanMakeActivePayment) { | |
1063 mQueriedCanMakeActivePayment = false; | |
1064 mClient.onCanMakeActivePayment(selection == 0 | |
1065 ? ActivePaymentQueryResult.CAN_MAKE_ACTIVE_PAYMENT | |
1066 : ActivePaymentQueryResult.CANNOT_MAKE_ACTIVE_PAYMEN T); | |
1067 if (sObserverForTest != null) { | |
1068 sObserverForTest.onPaymentRequestServiceActivePaymentQueryRespon ded(); | |
1069 } | |
1070 } | |
1071 | |
996 // The list of payment instruments is ready to display. | 1072 // The list of payment instruments is ready to display. |
997 mPaymentMethodsSection = new SectionInformation(PaymentRequestUI.TYPE_PA YMENT_METHODS, | 1073 mPaymentMethodsSection = new SectionInformation(PaymentRequestUI.TYPE_PA YMENT_METHODS, |
998 selection, mPendingInstruments); | 1074 selection, mPendingInstruments); |
999 | 1075 |
1000 mPendingInstruments.clear(); | 1076 mPendingInstruments.clear(); |
1001 | 1077 |
1002 // UI has requested the full list of payment instruments. Provide it now . | 1078 // UI has requested the full list of payment instruments. Provide it now . |
1003 if (mPaymentInformationCallback != null) providePaymentInformation(); | 1079 if (mPaymentInformationCallback != null) providePaymentInformation(); |
1004 } | 1080 } |
1005 | 1081 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1126 mPaymentMethodsSection = null; | 1202 mPaymentMethodsSection = null; |
1127 } | 1203 } |
1128 | 1204 |
1129 mContext.getTabModelSelector().removeObserver(mSelectorObserver); | 1205 mContext.getTabModelSelector().removeObserver(mSelectorObserver); |
1130 mContext.getCurrentTabModel().removeObserver(mTabModelObserver); | 1206 mContext.getCurrentTabModel().removeObserver(mTabModelObserver); |
1131 } | 1207 } |
1132 | 1208 |
1133 private void closeClient() { | 1209 private void closeClient() { |
1134 if (mClient != null) mClient.close(); | 1210 if (mClient != null) mClient.close(); |
1135 mClient = null; | 1211 mClient = null; |
1136 mDismissObserver.onPaymentRequestDismissed(); | 1212 mDisplayObserver.onPaymentRequestDismissed(); |
1137 } | 1213 } |
1138 | 1214 |
1139 @VisibleForTesting | 1215 @VisibleForTesting |
1140 public static void setObserverForTest(PaymentRequestServiceObserverForTest o bserverForTest) { | 1216 public static void setObserverForTest(PaymentRequestServiceObserverForTest o bserverForTest) { |
1141 sObserverForTest = observerForTest; | 1217 sObserverForTest = observerForTest; |
1142 } | 1218 } |
1143 | 1219 |
1144 /** | 1220 /** |
1145 * Records specific histograms related to the different steps of a successfu l checkout. | 1221 * Records specific histograms related to the different steps of a successfu l checkout. |
1146 */ | 1222 */ |
(...skipping 19 matching lines...) Expand all Loading... | |
1166 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, | 1242 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, |
1167 PaymentRequestMetrics.ABORT_REASON_MAX); | 1243 PaymentRequestMetrics.ABORT_REASON_MAX); |
1168 | 1244 |
1169 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { | 1245 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { |
1170 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); | 1246 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); |
1171 } else { | 1247 } else { |
1172 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); | 1248 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); |
1173 } | 1249 } |
1174 } | 1250 } |
1175 } | 1251 } |
OLD | NEW |