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

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

Issue 2790253002: [Payments] Don't record CanMakePayment when in incognito mode. (Closed)
Patch Set: Created 3 years, 8 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"
11 11
12 namespace payments { 12 namespace payments {
13 13
14 // A class to keep track of different stats during a Payment Request journey. It 14 // A class to keep track of different stats during a Payment Request journey. It
15 // collects different metrics during the course of the checkout flow, like the 15 // collects different metrics during the course of the checkout flow, like the
16 // number of credit cards that the user added or edited. The metrics will be 16 // number of credit cards that the user added or edited. The metrics will be
17 // logged when RecordJourneyStatsHistograms is called with the completion status 17 // logged when RecordJourneyStatsHistograms is called with the completion status
18 // of the Payment Request. 18 // of the Payment Request.
19 class JourneyLogger { 19 class JourneyLogger {
Mathieu 2017/04/03 20:19:31 a clearer API, in my opinion, is to have the Journ
sebsg 2017/04/03 21:04:26 Done.
20 public: 20 public:
21 // Note: These constants should always be in sync with their counterpart in 21 // Note: These constants should always be in sync with their counterpart in
22 // components/payments/content/android/java/src/org/chromium/components/ 22 // components/payments/content/android/java/src/org/chromium/components/
23 // payments/JourneyLogger.java. 23 // payments/JourneyLogger.java.
24 // The different sections of a Payment Request. Used to record journey 24 // The different sections of a Payment Request. Used to record journey
25 // stats. 25 // stats.
26 enum Section { 26 enum Section {
27 SECTION_CONTACT_INFO = 0, 27 SECTION_CONTACT_INFO = 0,
28 SECTION_CREDIT_CARDS = 1, 28 SECTION_CREDIT_CARDS = 1,
29 SECTION_SHIPPING_ADDRESS = 2, 29 SECTION_SHIPPING_ADDRESS = 2,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Sets the number of suggestions shown for the specified section. 68 // Sets the number of suggestions shown for the specified section.
69 void SetNumberOfSuggestionsShown(Section section, int number); 69 void SetNumberOfSuggestionsShown(Section section, int number);
70 70
71 // Records the fact that the merchant called CanMakePayment and records it's 71 // Records the fact that the merchant called CanMakePayment and records it's
72 // return value. 72 // return value.
73 void SetCanMakePaymentValue(bool value); 73 void SetCanMakePaymentValue(bool value);
74 74
75 // Records the fact that the Payment Request was shown to the user. 75 // Records the fact that the Payment Request was shown to the user.
76 void SetShowCalled(); 76 void SetShowCalled();
77 77
78 // Records the fact that the Payment Request was done in an incognito tab.
79 void SetIsIncognito();
80
78 // Records the histograms for all the sections that were requested by the 81 // Records the histograms for all the sections that were requested by the
79 // merchant and for the usage of the CanMakePayment method and its effect on 82 // merchant and for the usage of the CanMakePayment method and its effect on
80 // the transaction. This method should be called when the Payment Request has 83 // the transaction. This method should be called when the Payment Request has
81 // either been completed or aborted. 84 // either been completed or aborted.
82 void RecordJourneyStatsHistograms(CompletionStatus completion_status); 85 void RecordJourneyStatsHistograms(CompletionStatus completion_status);
83 86
84 private: 87 private:
85 static const int NUMBER_OF_SECTIONS = 3; 88 static const int NUMBER_OF_SECTIONS = 3;
86 89
87 // Note: These constants should always be in sync with their counterpart in 90 // Note: These constants should always be in sync with their counterpart in
(...skipping 17 matching lines...) Expand all
105 int number_selection_changes_; 108 int number_selection_changes_;
106 int number_selection_edits_; 109 int number_selection_edits_;
107 int number_suggestions_shown_; 110 int number_suggestions_shown_;
108 bool is_requested_; 111 bool is_requested_;
109 }; 112 };
110 113
111 // Records the histograms for all the sections that were requested by the 114 // Records the histograms for all the sections that were requested by the
112 // merchant. 115 // merchant.
113 void RecordSectionSpecificStats(CompletionStatus completion_status); 116 void RecordSectionSpecificStats(CompletionStatus completion_status);
114 117
115 // Records the metrics related the the CanMakePayment method. 118 // Records the metrics related the the CanMakePayment method, if the Payment
119 // Request was not done in an incognito tab.
116 void RecordCanMakePaymentStats(CompletionStatus completion_status); 120 void RecordCanMakePaymentStats(CompletionStatus completion_status);
117 121
118 // Records CanMakePayment's return value effect on whether the Payment Request 122 // Records CanMakePayment's return value effect on whether the Payment Request
119 // was shown or not. 123 // was shown or not.
120 void RecordCanMakePaymentEffectOnShow(); 124 void RecordCanMakePaymentEffectOnShow();
121 125
122 // Records the completion status depending on the the usage and return value 126 // Records the completion status depending on the the usage and return value
123 // of the CanMakePaymentMethod. 127 // of the CanMakePaymentMethod.
124 void RecordCanMakePaymentEffectOnCompletion( 128 void RecordCanMakePaymentEffectOnCompletion(
125 CompletionStatus completion_status); 129 CompletionStatus completion_status);
126 130
127 SectionStats sections_[NUMBER_OF_SECTIONS]; 131 SectionStats sections_[NUMBER_OF_SECTIONS];
128 bool was_can_make_payments_used_; 132 bool was_can_make_payments_used_;
129 bool could_make_payment_; 133 bool could_make_payment_;
130 bool was_show_called_; 134 bool was_show_called_;
135 bool is_incognito_;
131 136
132 DISALLOW_COPY_AND_ASSIGN(JourneyLogger); 137 DISALLOW_COPY_AND_ASSIGN(JourneyLogger);
133 }; 138 };
134 139
135 } // namespace payments 140 } // namespace payments
136 141
137 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_ 142 #endif // COMPONENTS_PAYMENTS_CORE_JOURNEY_LOGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698