| 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.metrics.RecordHistogram; | 7 import org.chromium.base.metrics.RecordHistogram; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * A class used to record journey metrics for the Payment Request feature. | 10 * A class used to record journey metrics for the Payment Request feature. |
| 11 */ | 11 */ |
| 12 public class PaymentRequestJourneyLogger { | 12 public class PaymentRequestJourneyLogger { |
| 13 public static final int SECTION_CONTACT_INFO = 0; | 13 public static final int SECTION_PAYER_INFO_INFO = 0; |
| 14 public static final int SECTION_CREDIT_CARDS = 1; | 14 public static final int SECTION_CREDIT_CARDS = 1; |
| 15 public static final int SECTION_SHIPPING_ADDRESS = 2; | 15 public static final int SECTION_SHIPPING_ADDRESS = 2; |
| 16 public static final int SECTION_MAX = 3; | 16 public static final int SECTION_MAX = 3; |
| 17 | 17 |
| 18 private static final int MIN_EXPECTED_SAMPLE = 0; | 18 private static final int MIN_EXPECTED_SAMPLE = 0; |
| 19 private static final int MAX_EXPECTED_SAMPLE = 49; | 19 private static final int MAX_EXPECTED_SAMPLE = 49; |
| 20 private static final int NUMBER_BUCKETS = 50; | 20 private static final int NUMBER_BUCKETS = 50; |
| 21 | 21 |
| 22 private static class SectionStats { | 22 private static class SectionStats { |
| 23 private int mNumberSuggestionsShown; | 23 private int mNumberSuggestionsShown; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 * | 84 * |
| 85 * @param submissionType A string indicating the way the payment request was
concluded. | 85 * @param submissionType A string indicating the way the payment request was
concluded. |
| 86 */ | 86 */ |
| 87 public void recordJourneyStatsHistograms(String submissionType) { | 87 public void recordJourneyStatsHistograms(String submissionType) { |
| 88 for (int i = 0; i < mSections.length; ++i) { | 88 for (int i = 0; i < mSections.length; ++i) { |
| 89 String nameSuffix = ""; | 89 String nameSuffix = ""; |
| 90 switch (i) { | 90 switch (i) { |
| 91 case SECTION_SHIPPING_ADDRESS: | 91 case SECTION_SHIPPING_ADDRESS: |
| 92 nameSuffix = "ShippingAddress." + submissionType; | 92 nameSuffix = "ShippingAddress." + submissionType; |
| 93 break; | 93 break; |
| 94 case SECTION_CONTACT_INFO: | 94 case SECTION_PAYER_INFO_INFO: |
| 95 nameSuffix = "ContactInfo." + submissionType; | 95 nameSuffix = "PayerInfo." + submissionType; |
| 96 break; | 96 break; |
| 97 case SECTION_CREDIT_CARDS: | 97 case SECTION_CREDIT_CARDS: |
| 98 nameSuffix = "CreditCards." + submissionType; | 98 nameSuffix = "CreditCards." + submissionType; |
| 99 break; | 99 break; |
| 100 default: | 100 default: |
| 101 break; | 101 break; |
| 102 } | 102 } |
| 103 | 103 |
| 104 assert !nameSuffix.isEmpty(); | 104 assert !nameSuffix.isEmpty(); |
| 105 | 105 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 "PaymentRequest.NumberOfSelectionEdits." + nameSuffix, | 117 "PaymentRequest.NumberOfSelectionEdits." + nameSuffix, |
| 118 Math.min(mSections[i].mNumberSelectionEdits, MAX_EXPECTE
D_SAMPLE), | 118 Math.min(mSections[i].mNumberSelectionEdits, MAX_EXPECTE
D_SAMPLE), |
| 119 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS
); | 119 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS
); |
| 120 RecordHistogram.recordCustomCountHistogram( | 120 RecordHistogram.recordCustomCountHistogram( |
| 121 "PaymentRequest.NumberOfSuggestionsShown." + nameSuffix, | 121 "PaymentRequest.NumberOfSuggestionsShown." + nameSuffix, |
| 122 Math.min(mSections[i].mNumberSuggestionsShown, MAX_EXPEC
TED_SAMPLE), | 122 Math.min(mSections[i].mNumberSuggestionsShown, MAX_EXPEC
TED_SAMPLE), |
| 123 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS
); | 123 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS
); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| OLD | NEW |