| 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.VisibleForTesting; | 7 import org.chromium.base.VisibleForTesting; |
| 8 import org.chromium.base.metrics.RecordHistogram; | 8 import org.chromium.base.metrics.RecordHistogram; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public static final int ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5; | 39 public static final int ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5; |
| 40 @VisibleForTesting | 40 @VisibleForTesting |
| 41 public static final int ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6; | 41 public static final int ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6; |
| 42 @VisibleForTesting | 42 @VisibleForTesting |
| 43 public static final int ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7; | 43 public static final int ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7; |
| 44 @VisibleForTesting | 44 @VisibleForTesting |
| 45 public static final int ABORT_REASON_OTHER = 8; | 45 public static final int ABORT_REASON_OTHER = 8; |
| 46 @VisibleForTesting | 46 @VisibleForTesting |
| 47 public static final int ABORT_REASON_MAX = 9; | 47 public static final int ABORT_REASON_MAX = 9; |
| 48 | 48 |
| 49 // PaymentRequestPaymentMethods defined in tools/metrics/histograms/histogra
ms.xml. |
| 50 @VisibleForTesting |
| 51 public static final int SELECTED_METHOD_CREDIT_CARD = 0; |
| 52 @VisibleForTesting |
| 53 public static final int SELECTED_METHOD_ANDROID_PAY = 1; |
| 54 @VisibleForTesting |
| 55 public static final int SELECTED_METHOD_OTHER_PAYMENT_APP = 2; |
| 56 @VisibleForTesting |
| 57 public static final int SELECTED_METHOD_MAX = 3; |
| 58 |
| 49 // There should be no instance of PaymentRequestMetrics created. | 59 // There should be no instance of PaymentRequestMetrics created. |
| 50 private PaymentRequestMetrics() {} | 60 private PaymentRequestMetrics() {} |
| 51 | 61 |
| 52 /* | 62 /* |
| 53 * Records the metric that keeps track of what user information are requeste
d by merchants to | 63 * Records the metric that keeps track of what user information are requeste
d by merchants to |
| 54 * complete a payment request. | 64 * complete a payment request. |
| 55 * | 65 * |
| 56 * @param requestEmail Whether the merchant requested an email address. | 66 * @param requestEmail Whether the merchant requested an email address. |
| 57 * @param requestPhone Whether the merchant requested a phone number. | 67 * @param requestPhone Whether the merchant requested a phone number. |
| 58 * @param requestShipping Whether the merchant requested a shipping address. | 68 * @param requestShipping Whether the merchant requested a shipping address. |
| 59 */ | 69 */ |
| 60 public static void recordRequestedInformationHistogram(boolean requestEmail, | 70 public static void recordRequestedInformationHistogram(boolean requestEmail, |
| 61 boolean requestPhone, boolean requestShipping) { | 71 boolean requestPhone, boolean requestShipping) { |
| 62 int requestInformation = | 72 int requestInformation = |
| 63 (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0) | 73 (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0) |
| 64 | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0) | 74 | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0) |
| 65 | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0); | 75 | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0); |
| 66 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInfor
mation", | 76 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInfor
mation", |
| 67 requestInformation, REQUESTED_INFORMATION_MAX); | 77 requestInformation, REQUESTED_INFORMATION_MAX); |
| 68 } | 78 } |
| 79 |
| 80 /* |
| 81 * Records the metric that keeps track of what payment method was used to co
mplete a Payment |
| 82 * Request transaction. |
| 83 * |
| 84 * @param paymentMethod The payment method that was used to complete the cur
rent transaction. |
| 85 */ |
| 86 public static void recordSelectedPaymentMethodHistogram(int paymentMethod) { |
| 87 assert paymentMethod < SELECTED_METHOD_MAX; |
| 88 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.SelectedPaymen
tMethod", |
| 89 paymentMethod, SELECTED_METHOD_MAX); |
| 90 } |
| 69 } | 91 } |
| OLD | NEW |