Chromium Code Reviews| Index: components/autofill/core/browser/autofill_ukm.h |
| diff --git a/components/autofill/core/browser/autofill_ukm.h b/components/autofill/core/browser/autofill_ukm.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e3dc42c267aa7d8a99101105fe625ea740ab4d74 |
| --- /dev/null |
| +++ b/components/autofill/core/browser/autofill_ukm.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ |
| +#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ |
| + |
| +#include "base/macros.h" |
| +#include "components/autofill/core/browser/autofill_metrics.h" |
| + |
| +class GURL; |
| + |
| +namespace ukm { |
| +class UkmService; |
| +} // namespace ukm |
| + |
| +namespace autofill { |
| + |
| +// 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
|
| +class AutofillUkm { |
|
Mathieu
2017/03/08 22:33:49
Would rename this AutofillUkmSession
|
| + public: |
| + AutofillUkm(ukm::UkmService* ukm_service); |
| + ~AutofillUkm(); |
| + |
| + // Sets the URL to be used when logging the next card upload decision metric. |
| + void SetCardUploadDecisionMetricUrl(const GURL& url); |
| + |
| + // Logs the card upload decision metric based on the set URL. Does nothing if |
| + // no URL is set. Resets the URL after the log. |
| + void LogCardUploadDecisionMetric( |
| + AutofillMetrics::CardUploadDecisionMetric upload_decision); |
| + |
| + private: |
| + // Returns whether a UKM should be logged for the specified |url|. |
| + bool ShouldLog(const GURL& url); |
| + |
| + // The URL to use for the next card upload decision metric log. |
| + std::unique_ptr<GURL> card_upload_decision_url_; |
| + |
| + // Used to log URL-keyed metrics. This pointer will outlive |this|. |
| + ukm::UkmService* ukm_service_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillUkm); |
|
Mathieu
2017/03/08 22:33:49
curious, why not DISALLOW_COPY_AND_ASSIGN?
|
| +}; |
| + |
| +} // namespace autofill |
| + |
| +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_UKM_H_ |