Changes for start_with_ext Telemetry test to work on Windows.
[chromium-blink-merge.git] / chrome / browser / metrics / omnibox_metrics_provider.h
blob9e76f1b77c059bba1084d87658a0b9ed2d97af36
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_METRICS_OMNIBOX_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_OMNIBOX_METRICS_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "components/metrics/metrics_provider.h"
10 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
14 struct OmniboxLog;
16 // OmniboxMetricsProvider is responsible for filling out the |omnibox_event|
17 // section of the UMA proto.
18 class OmniboxMetricsProvider : public metrics::MetricsProvider,
19 public content::NotificationObserver {
20 public:
21 OmniboxMetricsProvider();
22 ~OmniboxMetricsProvider() override;
24 // metrics::MetricsDataProvider:
25 void OnRecordingEnabled() override;
26 void OnRecordingDisabled() override;
27 void ProvideGeneralMetrics(
28 metrics::ChromeUserMetricsExtension* uma_proto) override;
30 private:
31 // content::NotificationObserver:
32 void Observe(int type,
33 const content::NotificationSource& source,
34 const content::NotificationDetails& details) override;
36 // Records the input text, available choices, and selected entry when the
37 // user uses the Omnibox to open a URL.
38 void RecordOmniboxOpenedURL(const OmniboxLog& log);
40 // Registar for receiving Omnibox event notifications.
41 content::NotificationRegistrar registrar_;
43 // Saved cache of generated Omnibox event protos, to be copied into the UMA
44 // proto when ProvideGeneralMetrics() is called.
45 metrics::ChromeUserMetricsExtension omnibox_events_cache;
47 DISALLOW_COPY_AND_ASSIGN(OmniboxMetricsProvider);
50 #endif // CHROME_BROWSER_METRICS_OMNIBOX_METRICS_PROVIDER_H_