OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ | |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/autofill/core/browser/autofill_metrics.h" | |
10 | |
11 class GURL; | |
12 | |
13 namespace ukm { | |
14 class UkmService; | |
15 } // namespace ukm | |
16 | |
17 namespace autofill { | |
18 | |
19 // A class to log Autofill related Url Keyed Metrics. | |
Mathieu
2017/03/08 22:33:49
Mention why it exists: sometimes the URL is not in
| |
20 class AutofillUkm { | |
Mathieu
2017/03/08 22:33:49
Would rename this AutofillUkmSession
| |
21 public: | |
22 AutofillUkm(ukm::UkmService* ukm_service); | |
23 ~AutofillUkm(); | |
24 | |
25 // Sets the URL to be used when logging the next card upload decision metric. | |
26 void SetCardUploadDecisionMetricUrl(const GURL& url); | |
27 | |
28 // Logs the card upload decision metric based on the set URL. Does nothing if | |
29 // no URL is set. Resets the URL after the log. | |
30 void LogCardUploadDecisionMetric( | |
31 AutofillMetrics::CardUploadDecisionMetric upload_decision); | |
32 | |
33 private: | |
34 // Returns whether a UKM should be logged for the specified |url|. | |
35 bool ShouldLog(const GURL& url); | |
36 | |
37 // The URL to use for the next card upload decision metric log. | |
38 std::unique_ptr<GURL> card_upload_decision_url_; | |
39 | |
40 // Used to log URL-keyed metrics. This pointer will outlive |this|. | |
41 ukm::UkmService* ukm_service_; | |
42 | |
43 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillUkm); | |
Mathieu
2017/03/08 22:33:49
curious, why not DISALLOW_COPY_AND_ASSIGN?
| |
44 }; | |
45 | |
46 } // namespace autofill | |
47 | |
48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ | |
OLD | NEW |