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

Side by Side Diff: components/payments/core/journey_logger.h

Issue 2904083003: [Payments] Use C++ metric enums in Java. (Closed)
Patch Set: Enum rename for Windows Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_ 5 #ifndef COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_
6 #define COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_ 6 #define COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 extern const char kUKMEventsMetricName[]; 23 extern const char kUKMEventsMetricName[];
24 } // namespace internal 24 } // namespace internal
25 25
26 // A class to keep track of different stats during a Payment Request journey. It 26 // A class to keep track of different stats during a Payment Request journey. It
27 // collects different metrics during the course of the checkout flow, like the 27 // collects different metrics during the course of the checkout flow, like the
28 // number of credit cards that the user added or edited. The metrics will be 28 // number of credit cards that the user added or edited. The metrics will be
29 // logged when RecordJourneyStatsHistograms is called with the completion status 29 // logged when RecordJourneyStatsHistograms is called with the completion status
30 // of the Payment Request. 30 // of the Payment Request.
31 class JourneyLogger { 31 class JourneyLogger {
32 public: 32 public:
33 // Note: These constants should always be in sync with their counterpart in 33 // Note: Java counterparts will be generated for these enums.
34 // components/payments/content/android/java/src/org/chromium/components/ 34
35 // payments/JourneyLogger.java.
36 // The different sections of a Payment Request. Used to record journey 35 // The different sections of a Payment Request. Used to record journey
37 // stats. 36 // stats.
37 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
38 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: Section
38 enum Section { 39 enum Section {
39 SECTION_CONTACT_INFO = 0, 40 SECTION_CONTACT_INFO = 0,
40 SECTION_CREDIT_CARDS = 1, 41 SECTION_CREDIT_CARDS = 1,
41 SECTION_SHIPPING_ADDRESS = 2, 42 SECTION_SHIPPING_ADDRESS = 2,
42 SECTION_MAX, 43 SECTION_MAX,
43 }; 44 };
44 45
45 // For the CanMakePayment histograms. 46 // For the CanMakePayment histograms.
47 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
48 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CanMakePaymentUsage
46 enum CanMakePaymentUsage { 49 enum CanMakePaymentUsage {
47 CAN_MAKE_PAYMENT_USED = 0, 50 CAN_MAKE_PAYMENT_USED = 0,
48 CAN_MAKE_PAYMENT_NOT_USED = 1, 51 CAN_MAKE_PAYMENT_NOT_USED = 1,
49 CAN_MAKE_PAYMENT_USE_MAX, 52 CAN_MAKE_PAYMENT_USE_MAX,
50 }; 53 };
51 54
55 // The information requested by the merchant.
56 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
57 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: RequestedInformation
58 enum RequestedInformation {
59 REQUESTED_INFORMATION_NONE = 0,
60 REQUESTED_INFORMATION_EMAIL = 1 << 0,
61 REQUESTED_INFORMATION_PHONE = 1 << 1,
62 REQUESTED_INFORMATION_SHIPPING = 1 << 2,
63 REQUESTED_INFORMATION_NAME = 1 << 3,
64 REQUESTED_INFORMATION_MAX = 16,
65 };
66
67 // The payment method that was used by the user to complete the transaction.
68 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
69 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: SelectedPaymentMethod
70 enum SelectedPaymentMethod {
71 SELECTED_PAYMENT_METHOD_CREDIT_CARD = 0,
72 SELECTED_PAYMENT_METHOD_ANDROID_PAY = 1,
73 SELECTED_PAYMENT_METHOD_OTHER_PAYMENT_APP = 2,
74 SELECTED_PAYMENT_METHOD_MAX = 3,
75 };
76
77 // Used to mesure the impact of the CanMakePayment return value on whether the
78 // Payment Request is shown to the user.
79 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
80 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CanMakePaymentEffectOnShow
81 enum CmpEffectOnShow {
82 CMP_EFFECT_ON_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0,
83 CMP_EFFECT_ON_SHOW_DID_SHOW = 1 << 0,
84 CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT = 1 << 1,
85 CMP_EFFECT_ON_SHOW_MAX = 4,
86 };
87
52 // Used to log different parameters' effect on whether the transaction was 88 // Used to log different parameters' effect on whether the transaction was
53 // completed. 89 // completed.
90 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
91 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CompletionStatus
54 enum CompletionStatus { 92 enum CompletionStatus {
55 COMPLETION_STATUS_COMPLETED = 0, 93 COMPLETION_STATUS_COMPLETED = 0,
56 COMPLETION_STATUS_USER_ABORTED = 1, 94 COMPLETION_STATUS_USER_ABORTED = 1,
57 COMPLETION_STATUS_OTHER_ABORTED = 2, 95 COMPLETION_STATUS_OTHER_ABORTED = 2,
58 COMPLETION_STATUS_MAX, 96 COMPLETION_STATUS_MAX,
59 }; 97 };
60 98
61 // Used to record the different events that happened during the Payment 99 // Used to record the different events that happened during the Payment
62 // Request. 100 // Request.
101 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
102 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: Event
63 enum Event { 103 enum Event {
64 EVENT_INITIATED = 0, 104 EVENT_INITIATED = 0,
65 EVENT_SHOWN = 1 << 0, 105 EVENT_SHOWN = 1 << 0,
66 EVENT_PAY_CLICKED = 1 << 1, 106 EVENT_PAY_CLICKED = 1 << 1,
67 EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2, 107 EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2,
68 EVENT_SKIPPED_SHOW = 1 << 3, 108 EVENT_SKIPPED_SHOW = 1 << 3,
69 EVENT_ENUM_MAX = 16, 109 EVENT_ENUM_MAX = 16,
70 }; 110 };
71 111
112 // The reason why the Payment Request was aborted.
113 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
114 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: AbortReason
72 enum AbortReason { 115 enum AbortReason {
73 ABORT_REASON_ABORTED_BY_USER = 0, 116 ABORT_REASON_ABORTED_BY_USER = 0,
74 ABORT_REASON_ABORTED_BY_MERCHANT = 1, 117 ABORT_REASON_ABORTED_BY_MERCHANT = 1,
75 ABORT_REASON_INVALID_DATA_FROM_RENDERER = 2, 118 ABORT_REASON_INVALID_DATA_FROM_RENDERER = 2,
76 ABORT_REASON_MOJO_CONNECTION_ERROR = 3, 119 ABORT_REASON_MOJO_CONNECTION_ERROR = 3,
77 ABORT_REASON_MOJO_RENDERER_CLOSING = 4, 120 ABORT_REASON_MOJO_RENDERER_CLOSING = 4,
78 ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5, 121 ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5,
79 ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6, // Deprecated. 122 ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6, // Deprecated.
80 ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7, // Deprecated. 123 ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7, // Deprecated.
81 ABORT_REASON_OTHER = 8, 124 ABORT_REASON_OTHER = 8,
82 ABORT_REASON_MAX, 125 ABORT_REASON_MAX,
83 }; 126 };
84 127
85 #ifdef OS_ANDROID 128 #ifdef OS_ANDROID
129 // The reason why the Payment Request was not shown to the user.
130 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
131 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: NotShownReason
86 enum NotShownReason { 132 enum NotShownReason {
87 NOT_SHOWN_NO_MATCHING_PAYMENT_METHOD = 0, 133 NOT_SHOWN_REASON_NO_MATCHING_PAYMENT_METHOD = 0,
88 NOT_SHOWN_NO_SUPPORTED_PAYMENT_METHOD = 1, 134 NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD = 1,
89 NOT_SHOWN_CONCURRENT_REQUESTS = 2, 135 NOT_SHOWN_REASON_CONCURRENT_REQUESTS = 2,
90 NOT_SHOWN_REASON_OTHER = 3, 136 NOT_SHOWN_REASON_OTHER = 3,
91 NOT_SHOWN_REASON_MAX = 4, 137 NOT_SHOWN_REASON_MAX = 4,
92 }; 138 };
93 #endif 139 #endif
94 140
95 // Used to mesure the impact of the CanMakePayment return value on whether the
96 // Payment Request is shown to the user.
97 static const int CMP_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0;
98 static const int CMP_SHOW_DID_SHOW = 1 << 0;
99 static const int CMP_SHOW_COULD_MAKE_PAYMENT = 1 << 1;
100 static const int CMP_SHOW_MAX = 4;
101
102 JourneyLogger(bool is_incognito, 141 JourneyLogger(bool is_incognito,
103 const GURL& url, 142 const GURL& url,
104 ukm::UkmRecorder* ukm_recorder); 143 ukm::UkmRecorder* ukm_recorder);
105 ~JourneyLogger(); 144 ~JourneyLogger();
106 145
107 // Increments the number of selection adds for the specified section. 146 // Increments the number of selection adds for the specified section.
108 void IncrementSelectionAdds(Section section); 147 void IncrementSelectionAdds(Section section);
109 148
110 // Increments the number of selection changes for the specified section. 149 // Increments the number of selection changes for the specified section.
111 void IncrementSelectionChanges(Section section); 150 void IncrementSelectionChanges(Section section);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 250
212 // Not owned, will outlive this object. 251 // Not owned, will outlive this object.
213 ukm::UkmRecorder* ukm_recorder_; 252 ukm::UkmRecorder* ukm_recorder_;
214 253
215 DISALLOW_COPY_AND_ASSIGN(JourneyLogger); 254 DISALLOW_COPY_AND_ASSIGN(JourneyLogger);
216 }; 255 };
217 256
218 } // namespace payments 257 } // namespace payments
219 258
220 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_ 259 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698