OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ | 5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ |
6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ | 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void RecordUserDecision(Decision decision); | 85 void RecordUserDecision(Decision decision); |
86 void RecordUserInteraction(Interaction interaction); | 86 void RecordUserInteraction(Interaction interaction); |
87 void RecordShutdownMetrics(); | 87 void RecordShutdownMetrics(); |
88 | 88 |
89 // Number of times user visited this origin before. -1 means not-yet-set. | 89 // Number of times user visited this origin before. -1 means not-yet-set. |
90 int NumVisits(); | 90 int NumVisits(); |
91 | 91 |
92 protected: | 92 protected: |
93 // Subclasses should implement any embedder-specific recording logic in these | 93 // Subclasses should implement any embedder-specific recording logic in these |
94 // methods. They'll be invoked from the matching Record methods. | 94 // methods. They'll be invoked from the matching Record methods. |
95 virtual void RecordExtraUserDecisionMetrics(Decision decision) = 0; | 95 virtual void RecordExtraUserDecisionMetrics(Decision decision); |
96 virtual void RecordExtraUserInteractionMetrics(Interaction interaction) = 0; | 96 virtual void RecordExtraUserInteractionMetrics(Interaction interaction); |
97 virtual void RecordExtraShutdownMetrics() = 0; | 97 virtual void RecordExtraShutdownMetrics(); |
98 | 98 |
99 private: | 99 private: |
100 // Used to query the HistoryService to see if the URL is in history. It will | 100 // Used to query the HistoryService to see if the URL is in history. It will |
101 // only be invoked if the constructor received |history_service|. | 101 // only be invoked if the constructor received |history_service|. |
102 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 102 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
103 | 103 |
104 void RecordUserDecisionToMetrics(Decision decision, | 104 void RecordUserDecisionToMetrics(Decision decision, |
105 const std::string& histogram_name); | 105 const std::string& histogram_name); |
106 const GURL request_url_; | 106 const GURL request_url_; |
107 const ReportDetails settings_; | 107 const ReportDetails settings_; |
108 int num_visits_; | 108 int num_visits_; |
109 base::CancelableTaskTracker request_tracker_; | 109 base::CancelableTaskTracker request_tracker_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(MetricsHelper); | 111 DISALLOW_COPY_AND_ASSIGN(MetricsHelper); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace security_interstitials | 114 } // namespace security_interstitials |
115 | 115 |
116 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ | 116 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_METRICS_HELPER_H_ |
OLD | NEW |