OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
7 // | 7 // |
8 // OVERVIEW | 8 // OVERVIEW |
9 // | 9 // |
10 // A MetricsService instance is typically created at application startup. It is | 10 // A MetricsService instance is typically created at application startup. It is |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 // saved for re-transmission. These duplicates could be filtered out server | 145 // saved for re-transmission. These duplicates could be filtered out server |
146 // side, but are not expected to be a significant problem. | 146 // side, but are not expected to be a significant problem. |
147 // | 147 // |
148 // | 148 // |
149 //------------------------------------------------------------------------------ | 149 //------------------------------------------------------------------------------ |
150 | 150 |
151 #include "chrome/browser/metrics/metrics_service.h" | 151 #include "chrome/browser/metrics/metrics_service.h" |
152 | 152 |
153 #include <algorithm> | 153 #include <algorithm> |
154 | 154 |
155 #include "ash/launcher/launcher.h" | |
155 #include "base/bind.h" | 156 #include "base/bind.h" |
156 #include "base/callback.h" | 157 #include "base/callback.h" |
157 #include "base/command_line.h" | 158 #include "base/command_line.h" |
158 #include "base/guid.h" | 159 #include "base/guid.h" |
159 #include "base/md5.h" | 160 #include "base/md5.h" |
160 #include "base/metrics/histogram.h" | 161 #include "base/metrics/histogram.h" |
161 #include "base/metrics/sparse_histogram.h" | 162 #include "base/metrics/sparse_histogram.h" |
162 #include "base/metrics/statistics_recorder.h" | 163 #include "base/metrics/statistics_recorder.h" |
163 #include "base/prefs/pref_registry_simple.h" | 164 #include "base/prefs/pref_registry_simple.h" |
164 #include "base/prefs/pref_service.h" | 165 #include "base/prefs/pref_service.h" |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 | 1147 |
1147 void MetricsService::SaveLocalState() { | 1148 void MetricsService::SaveLocalState() { |
1148 PrefService* pref = g_browser_process->local_state(); | 1149 PrefService* pref = g_browser_process->local_state(); |
1149 if (!pref) { | 1150 if (!pref) { |
1150 NOTREACHED(); | 1151 NOTREACHED(); |
1151 return; | 1152 return; |
1152 } | 1153 } |
1153 | 1154 |
1154 RecordCurrentState(pref); | 1155 RecordCurrentState(pref); |
1155 | 1156 |
1157 #if defined(OS_CHROMEOS) | |
1158 // Query the current state of the shelf alignment to gather an impression of | |
1159 // how much user time is being spent in each alignment. | |
1160 ash::Launcher::ForPrimaryDisplay()->RecordCurrentAlignmentForUMAHistogram( | |
James Cook
2013/10/30 16:49:12
Now that I think about it more, this really needs
| |
1161 "Ash.ShelfAlignmentOverTime"); | |
1162 #endif | |
1163 | |
1156 // TODO(jar):110021 Does this run down the batteries???? | 1164 // TODO(jar):110021 Does this run down the batteries???? |
1157 ScheduleNextStateSave(); | 1165 ScheduleNextStateSave(); |
1158 } | 1166 } |
1159 | 1167 |
1160 | 1168 |
1161 //------------------------------------------------------------------------------ | 1169 //------------------------------------------------------------------------------ |
1162 // Recording control methods | 1170 // Recording control methods |
1163 | 1171 |
1164 void MetricsService::OpenNewLog() { | 1172 void MetricsService::OpenNewLog() { |
1165 DCHECK(!log_manager_.current_log()); | 1173 DCHECK(!log_manager_.current_log()); |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1868 if (local_state) { | 1876 if (local_state) { |
1869 const PrefService::Preference* uma_pref = | 1877 const PrefService::Preference* uma_pref = |
1870 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1878 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1871 if (uma_pref) { | 1879 if (uma_pref) { |
1872 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1880 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1873 DCHECK(success); | 1881 DCHECK(success); |
1874 } | 1882 } |
1875 } | 1883 } |
1876 return result; | 1884 return result; |
1877 } | 1885 } |
OLD | NEW |