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

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

Issue 2904083003: [Payments] Use C++ metric enums in Java. (Closed)
Patch Set: 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 // A Java counterpart will be generated for this enum.
gogerald1 2017/05/29 16:05:42 no need this line since you comment and the beginn
sebsg 2017/05/29 16:44:49 Oops this one slipped past me, thanks!
48 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
49 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CanMakePaymentUsage
46 enum CanMakePaymentUsage { 50 enum CanMakePaymentUsage {
47 CAN_MAKE_PAYMENT_USED = 0, 51 CAN_MAKE_PAYMENT_USED = 0,
48 CAN_MAKE_PAYMENT_NOT_USED = 1, 52 CAN_MAKE_PAYMENT_NOT_USED = 1,
49 CAN_MAKE_PAYMENT_USE_MAX, 53 CAN_MAKE_PAYMENT_USE_MAX,
50 }; 54 };
51 55
56 // The information requested by the merchant.
57 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
58 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: RequestedInformation
59 enum RequestedInformation {
60 REQUESTED_INFORMATION_NONE = 0,
61 REQUESTED_INFORMATION_EMAIL = 1 << 0,
62 REQUESTED_INFORMATION_PHONE = 1 << 1,
63 REQUESTED_INFORMATION_SHIPPING = 1 << 2,
64 REQUESTED_INFORMATION_NAME = 1 << 3,
65 REQUESTED_INFORMATION_MAX = 16,
66 };
67
68 // The payment method that was used by the user to complete the transaction.
69 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
70 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: SelectedPaymentMethod
71 enum SelectedPaymentMethod {
72 SELECTED_PAYMENT_METHOD_CREDIT_CARD = 0,
73 SELECTED_PAYMENT_METHOD_ANDROID_PAY = 1,
74 SELECTED_PAYMENT_METHOD_OTHER_PAYMENT_APP = 2,
75 SELECTED_PAYMENT_METHOD_MAX = 3,
76 };
77
78 // Used to mesure the impact of the CanMakePayment return value on whether the
79 // Payment Request is shown to the user.
80 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
81 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CanMakePaymentEffectOnShow
82 enum CmpEffectOnShow {
83 CMP_EFFECT_ON_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0,
84 CMP_EFFECT_ON_SHOW_DID_SHOW = 1 << 0,
85 CMP_EFFECT_ON_SHOW_COULD_MAKE_PAYMENT = 1 << 1,
86 CMP_EFFECT_ON_SHOW_MAX = 4,
87 };
88
52 // Used to log different parameters' effect on whether the transaction was 89 // Used to log different parameters' effect on whether the transaction was
53 // completed. 90 // completed.
91 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
92 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: CompletionStatus
54 enum CompletionStatus { 93 enum CompletionStatus {
55 COMPLETION_STATUS_COMPLETED = 0, 94 COMPLETION_STATUS_COMPLETED = 0,
56 COMPLETION_STATUS_USER_ABORTED = 1, 95 COMPLETION_STATUS_USER_ABORTED = 1,
57 COMPLETION_STATUS_OTHER_ABORTED = 2, 96 COMPLETION_STATUS_OTHER_ABORTED = 2,
58 COMPLETION_STATUS_MAX, 97 COMPLETION_STATUS_MAX,
59 }; 98 };
60 99
61 // Used to record the different events that happened during the Payment 100 // Used to record the different events that happened during the Payment
62 // Request. 101 // Request.
102 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
103 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: Event
63 enum Event { 104 enum Event {
64 EVENT_INITIATED = 0, 105 EVENT_INITIATED = 0,
65 EVENT_SHOWN = 1 << 0, 106 EVENT_SHOWN = 1 << 0,
66 EVENT_PAY_CLICKED = 1 << 1, 107 EVENT_PAY_CLICKED = 1 << 1,
67 EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2, 108 EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2,
68 EVENT_SKIPPED_SHOW = 1 << 3, 109 EVENT_SKIPPED_SHOW = 1 << 3,
69 EVENT_ENUM_MAX = 16, 110 EVENT_MAX = 16,
70 }; 111 };
71 112
113 // The reason why the Payment Request was aborted.
114 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
115 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: AbortReason
72 enum AbortReason { 116 enum AbortReason {
73 ABORT_REASON_ABORTED_BY_USER = 0, 117 ABORT_REASON_ABORTED_BY_USER = 0,
74 ABORT_REASON_ABORTED_BY_MERCHANT = 1, 118 ABORT_REASON_ABORTED_BY_MERCHANT = 1,
75 ABORT_REASON_INVALID_DATA_FROM_RENDERER = 2, 119 ABORT_REASON_INVALID_DATA_FROM_RENDERER = 2,
76 ABORT_REASON_MOJO_CONNECTION_ERROR = 3, 120 ABORT_REASON_MOJO_CONNECTION_ERROR = 3,
77 ABORT_REASON_MOJO_RENDERER_CLOSING = 4, 121 ABORT_REASON_MOJO_RENDERER_CLOSING = 4,
78 ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5, 122 ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5,
79 ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6, // Deprecated. 123 ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6, // Deprecated.
80 ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7, // Deprecated. 124 ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7, // Deprecated.
81 ABORT_REASON_OTHER = 8, 125 ABORT_REASON_OTHER = 8,
82 ABORT_REASON_MAX, 126 ABORT_REASON_MAX,
83 }; 127 };
84 128
85 #ifdef OS_ANDROID 129 #ifdef OS_ANDROID
130 // The reason why the Payment Request was not shown to the user.
131 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.payments
132 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: NotShownReason
86 enum NotShownReason { 133 enum NotShownReason {
87 NOT_SHOWN_NO_MATCHING_PAYMENT_METHOD = 0, 134 NOT_SHOWN_REASON_NO_MATCHING_PAYMENT_METHOD = 0,
88 NOT_SHOWN_NO_SUPPORTED_PAYMENT_METHOD = 1, 135 NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD = 1,
89 NOT_SHOWN_CONCURRENT_REQUESTS = 2, 136 NOT_SHOWN_REASON_CONCURRENT_REQUESTS = 2,
90 NOT_SHOWN_REASON_OTHER = 3, 137 NOT_SHOWN_REASON_OTHER = 3,
91 NOT_SHOWN_REASON_MAX = 4, 138 NOT_SHOWN_REASON_MAX = 4,
92 }; 139 };
93 #endif 140 #endif
94 141
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, 142 JourneyLogger(bool is_incognito,
103 const GURL& url, 143 const GURL& url,
104 ukm::UkmRecorder* ukm_recorder); 144 ukm::UkmRecorder* ukm_recorder);
105 ~JourneyLogger(); 145 ~JourneyLogger();
106 146
107 // Increments the number of selection adds for the specified section. 147 // Increments the number of selection adds for the specified section.
108 void IncrementSelectionAdds(Section section); 148 void IncrementSelectionAdds(Section section);
109 149
110 // Increments the number of selection changes for the specified section. 150 // Increments the number of selection changes for the specified section.
111 void IncrementSelectionChanges(Section section); 151 void IncrementSelectionChanges(Section section);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 251
212 // Not owned, will outlive this object. 252 // Not owned, will outlive this object.
213 ukm::UkmRecorder* ukm_recorder_; 253 ukm::UkmRecorder* ukm_recorder_;
214 254
215 DISALLOW_COPY_AND_ASSIGN(JourneyLogger); 255 DISALLOW_COPY_AND_ASSIGN(JourneyLogger);
216 }; 256 };
217 257
218 } // namespace payments 258 } // namespace payments
219 259
220 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_ 260 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698