OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/metrics/android_metrics_provider.h" | 5 #include "chrome/browser/metrics/android_metrics_provider.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 AndroidMetricsProvider::AndroidMetricsProvider(PrefService* local_state) | 32 AndroidMetricsProvider::AndroidMetricsProvider(PrefService* local_state) |
33 : local_state_(local_state) { | 33 : local_state_(local_state) { |
34 LogStabilityToPrefs(); | 34 LogStabilityToPrefs(); |
35 } | 35 } |
36 | 36 |
37 AndroidMetricsProvider::~AndroidMetricsProvider() { | 37 AndroidMetricsProvider::~AndroidMetricsProvider() { |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 void AndroidMetricsProvider::ProvideStabilityMetrics( | 41 void AndroidMetricsProvider::ProvideStabilityMetrics( |
42 metrics::SystemProfileProto_Stability* stability_proto) { | 42 metrics::SystemProfileProto* system_profile_proto) { |
43 ConvertStabilityPrefsToHistograms(); | 43 ConvertStabilityPrefsToHistograms(); |
44 } | 44 } |
45 | 45 |
46 void AndroidMetricsProvider::LogStabilityToPrefs() { | 46 void AndroidMetricsProvider::LogStabilityToPrefs() { |
47 // Track which Activities were launched by the user. | 47 // Track which Activities were launched by the user. |
48 // A 'launch' is defined as starting the Activity at least once during a | 48 // A 'launch' is defined as starting the Activity at least once during a |
49 // UMA session. Multiple launches are counted only once since it is possible | 49 // UMA session. Multiple launches are counted only once since it is possible |
50 // for users to hop between Activities (e.g. entering and leaving Settings). | 50 // for users to hop between Activities (e.g. entering and leaving Settings). |
51 const int launched = | 51 const int launched = |
52 local_state_->GetInteger(prefs::kStabilityLaunchedActivityFlags); | 52 local_state_->GetInteger(prefs::kStabilityLaunchedActivityFlags); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 // static | 140 // static |
141 void AndroidMetricsProvider::RegisterPrefs(PrefRegistrySimple* registry) { | 141 void AndroidMetricsProvider::RegisterPrefs(PrefRegistrySimple* registry) { |
142 registry->RegisterIntegerPref(prefs::kStabilityForegroundActivityType, | 142 registry->RegisterIntegerPref(prefs::kStabilityForegroundActivityType, |
143 ActivityTypeIds::ACTIVITY_NONE); | 143 ActivityTypeIds::ACTIVITY_NONE); |
144 registry->RegisterIntegerPref(prefs::kStabilityLaunchedActivityFlags, 0); | 144 registry->RegisterIntegerPref(prefs::kStabilityLaunchedActivityFlags, 0); |
145 registry->RegisterListPref(prefs::kStabilityLaunchedActivityCounts); | 145 registry->RegisterListPref(prefs::kStabilityLaunchedActivityCounts); |
146 registry->RegisterListPref(prefs::kStabilityCrashedActivityCounts); | 146 registry->RegisterListPref(prefs::kStabilityCrashedActivityCounts); |
147 } | 147 } |
OLD | NEW |