Clean up extension confirmation prompts and make them consistent between Views and...
[chromium-blink-merge.git] / components / metrics / metrics_provider.h
blob226d1cd96aacf5ec629200cf058f3383d71149d7
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 COMPONENTS_METRICS_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_METRICS_PROVIDER_H_
8 #include "base/basictypes.h"
10 namespace metrics {
12 class ChromeUserMetricsExtension;
13 class SystemProfileProto;
14 class SystemProfileProto_Stability;
16 // MetricsProvider is an interface allowing different parts of the UMA protos to
17 // be filled out by different classes.
18 class MetricsProvider {
19 public:
20 MetricsProvider();
21 virtual ~MetricsProvider();
23 // Called when a new MetricsLog is created.
24 virtual void OnDidCreateMetricsLog();
26 // Called when metrics recording has been enabled.
27 virtual void OnRecordingEnabled();
29 // Called when metrics recording has been disabled.
30 virtual void OnRecordingDisabled();
32 // Provides additional metrics into the system profile.
33 virtual void ProvideSystemProfileMetrics(
34 SystemProfileProto* system_profile_proto);
36 // Called once at startup to see whether this provider has critical stability
37 // events to share in an initial stability log.
38 // Returning true can trigger ProvideInitialStabilityMetrics and
39 // ProvideStabilityMetrics on all other registered metrics providers.
40 // Default implementation always returns false.
41 virtual bool HasInitialStabilityMetrics();
43 // Called at most once at startup when an initial stability log is created.
44 // It provides critical statiblity metrics that need to be reported in an
45 // initial stability log.
46 // Default implementation is a no-op.
47 virtual void ProvideInitialStabilityMetrics(
48 SystemProfileProto* system_profile_proto);
50 // Provides additional stability metrics. Stability metrics can be provided
51 // directly into |stability_proto| fields or by logging stability histograms
52 // via the UMA_STABILITY_HISTOGRAM_ENUMERATION() macro.
53 virtual void ProvideStabilityMetrics(
54 SystemProfileProto* system_profile_proto);
56 // Called to indicate that saved stability prefs should be cleared, e.g.
57 // because they are from an old version and should not be kept.
58 virtual void ClearSavedStabilityMetrics();
60 // Provides general metrics that are neither system profile nor stability
61 // metrics. May also be used to add histograms when final metrics are
62 // collected right before upload.
63 virtual void ProvideGeneralMetrics(
64 ChromeUserMetricsExtension* uma_proto);
66 private:
67 DISALLOW_COPY_AND_ASSIGN(MetricsProvider);
70 } // namespace metrics
72 #endif // COMPONENTS_METRICS_METRICS_PROVIDER_H_