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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 2642213005: [Payments] Add CanMakePayment metrics. (Closed)
Patch Set: Created 3 years, 11 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
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.content.Intent; 8 import android.content.Intent;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 setIsShowing(true); 472 setIsShowing(true);
473 if (disconnectIfNoPaymentMethodsSupported()) return; 473 if (disconnectIfNoPaymentMethodsSupported()) return;
474 474
475 // Catch any time the user switches tabs. Because the dialog is modal, a user shouldn't be 475 // Catch any time the user switches tabs. Because the dialog is modal, a user shouldn't be
476 // allowed to switch tabs, which can happen if the user receives an exte rnal Intent. 476 // allowed to switch tabs, which can happen if the user receives an exte rnal Intent.
477 mContext.getTabModelSelector().addObserver(mSelectorObserver); 477 mContext.getTabModelSelector().addObserver(mSelectorObserver);
478 mContext.getCurrentTabModel().addObserver(mTabModelObserver); 478 mContext.getCurrentTabModel().addObserver(mTabModelObserver);
479 479
480 mUI.show(); 480 mUI.show();
481 recordSuccessFunnelHistograms("Shown"); 481 recordSuccessFunnelHistograms("Shown");
482 mJourneyLogger.setShowCalled();
482 } 483 }
483 484
484 private static Map<String, PaymentMethodData> getValidatedMethodData( 485 private static Map<String, PaymentMethodData> getValidatedMethodData(
485 PaymentMethodData[] methodData, CardEditor paymentMethodsCollector) { 486 PaymentMethodData[] methodData, CardEditor paymentMethodsCollector) {
486 // Payment methodData are required. 487 // Payment methodData are required.
487 if (methodData == null || methodData.length == 0) return null; 488 if (methodData == null || methodData.length == 0) return null;
488 Map<String, PaymentMethodData> result = new ArrayMap<>(); 489 Map<String, PaymentMethodData> result = new ArrayMap<>();
489 for (int i = 0; i < methodData.length; i++) { 490 for (int i = 0; i < methodData.length; i++) {
490 String[] methods = methodData[i].supportedMethods; 491 String[] methods = methodData[i].supportedMethods;
491 492
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 } 1142 }
1142 return; 1143 return;
1143 } 1144 }
1144 1145
1145 if (query.getPreviousResponse() != null) { 1146 if (query.getPreviousResponse() != null) {
1146 respondCanMakePaymentQuery(query.getPreviousResponse().booleanValue( )); 1147 respondCanMakePaymentQuery(query.getPreviousResponse().booleanValue( ));
1147 return; 1148 return;
1148 } 1149 }
1149 1150
1150 query.addObserver(this); 1151 query.addObserver(this);
1151 if (isFinishedQueryingPaymentApps()) query.setResponse(mCanMakePayment); 1152 if (isFinishedQueryingPaymentApps()) {
1153 query.setResponse(mCanMakePayment);
1154 mJourneyLogger.setCanMakePaymentValue(mCanMakePayment);
1155 }
1152 } 1156 }
1153 1157
1154 private void respondCanMakePaymentQuery(boolean response) { 1158 private void respondCanMakePaymentQuery(boolean response) {
1155 mClient.onCanMakePayment(response ? CanMakePaymentQueryResult.CAN_MAKE_P AYMENT 1159 mClient.onCanMakePayment(response ? CanMakePaymentQueryResult.CAN_MAKE_P AYMENT
1156 : CanMakePaymentQueryResult.CANNOT_MAKE_PAYMENT); 1160 : CanMakePaymentQueryResult.CANNOT_MAKE_PAYMENT);
1161 mJourneyLogger.setCanMakePaymentValue(mCanMakePayment);
1157 if (sObserverForTest != null) { 1162 if (sObserverForTest != null) {
1158 sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded (); 1163 sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded ();
1159 } 1164 }
1160 } 1165 }
1161 1166
1162 /** 1167 /**
1163 * Called when the renderer closes the Mojo connection. 1168 * Called when the renderer closes the Mojo connection.
1164 */ 1169 */
1165 @Override 1170 @Override
1166 public void close() { 1171 public void close() {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, 1472 "PaymentRequest.CheckoutFunnel.Aborted", abortReason,
1468 PaymentRequestMetrics.ABORT_REASON_MAX); 1473 PaymentRequestMetrics.ABORT_REASON_MAX);
1469 1474
1470 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { 1475 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) {
1471 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); 1476 mJourneyLogger.recordJourneyStatsHistograms("UserAborted");
1472 } else { 1477 } else {
1473 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); 1478 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted");
1474 } 1479 }
1475 } 1480 }
1476 } 1481 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698