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_ANDROID_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_ANDROID_METRICS_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/android/activity_type_ids.h"
10 #include "components/metrics/metrics_provider.h"
13 class PrefRegistrySimple
;
16 class ChromeUserMetricsExtension
;
19 // AndroidMetricsProvider provides Android-specific stability metrics.
20 class AndroidMetricsProvider
: public metrics::MetricsProvider
{
22 // Creates the AndroidMetricsProvider with the given |local_state|.
23 explicit AndroidMetricsProvider(PrefService
* local_state
);
24 ~AndroidMetricsProvider() override
;
26 // metrics::MetricsProvider:
27 void ProvideStabilityMetrics(
28 metrics::SystemProfileProto
* system_profile_proto
) override
;
29 void ProvideGeneralMetrics(
30 metrics::ChromeUserMetricsExtension
* uma_proto
) override
;
32 // Called when the Activity that the user interacts with is swapped out.
33 // TODO(asvitkine): Expose a way for Android code to actually invoke this.
34 void OnForegroundActivityChanged(ActivityTypeIds::Type type
);
36 // Registers local state prefs used by this class.
37 static void RegisterPrefs(PrefRegistrySimple
* registry
);
40 // Called to log launch and crash stats to preferences.
41 void LogStabilityToPrefs();
43 // Converts crash stats stored in the preferences into histograms.
44 void ConvertStabilityPrefsToHistograms();
46 // Weak pointer to the local state prefs store.
47 PrefService
* local_state_
;
49 DISALLOW_COPY_AND_ASSIGN(AndroidMetricsProvider
);
52 #endif // CHROME_BROWSER_METRICS_ANDROID_METRICS_PROVIDER_H_