blob: 8b004dadf859c21f174c1d89b0e725a86d34cf53 [file] [log] [blame]
// Copyright 2014 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.
#include "base/basictypes.h"
#include "chrome/browser/android/activity_type_ids.h"
#include "components/metrics/metrics_provider.h"
class PrefService;
class PrefRegistrySimple;
// AndroidMetricsProvider provides Android-specific stability metrics.
class AndroidMetricsProvider : public metrics::MetricsProvider {
// Creates the AndroidMetricsProvider with the given |local_state|.
explicit AndroidMetricsProvider(PrefService* local_state);
virtual ~AndroidMetricsProvider();
// Called when the Activity that the user interacts with is swapped out.
// TODO(asvitkine): Expose a way for Android code to actually invoke this.
void OnForegroundActivityChanged(ActivityTypeIds::Type type);
// metrics::MetricsDataProvider:
virtual void ProvideStabilityMetrics(
metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
// Registers local state prefs used by this class.
static void RegisterPrefs(PrefRegistrySimple* registry);
// Called to log launch and crash stats to preferences.
void LogStabilityToPrefs();
// Converts crash stats stored in the preferences into histograms.
void ConvertStabilityPrefsToHistograms();
// Weak pointer to the local state prefs store.
PrefService* local_state_;