OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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. | |
4 | |
5 #include "ash/ash_periodic_metrics_recorder.h" | |
6 | |
7 #include "ash/shelf/shelf_layout_manager.h" | |
8 #include "ash/shelf/shelf_widget.h" | |
9 #include "ash/shell.h" | |
10 #include "base/metrics/histogram.h" | |
11 | |
12 namespace ash { | |
13 namespace { | |
14 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0; | |
15 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1; | |
16 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2; | |
17 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3; | |
18 } | |
19 | |
20 // Time in seconds between calls to "RecordMetrics". | |
21 const int kAshPeridicMetricsTimeInSeconds = 1 * 60; | |
James Cook
2013/11/01 00:28:51
Peridic -> Periodic
Harry McCleave
2013/11/01 01:00:38
Done.
| |
22 | |
23 AshPeriodicMetricsRecorder::AshPeriodicMetricsRecorder() { | |
24 timer_.Start(FROM_HERE, | |
25 base::TimeDelta::FromSeconds(kAshPeridicMetricsTimeInSeconds), | |
26 this, | |
27 &AshPeriodicMetricsRecorder::RecordMetrics); | |
28 } | |
29 | |
30 AshPeriodicMetricsRecorder::~AshPeriodicMetricsRecorder() { | |
31 timer_.Stop(); | |
32 } | |
33 | |
34 void AshPeriodicMetricsRecorder::RecordMetrics() { | |
35 internal::ShelfLayoutManager *manager = | |
James Cook
2013/11/01 00:28:51
nit: * on left
Harry McCleave
2013/11/01 01:00:38
Done.
| |
36 internal::ShelfLayoutManager::ForLauncher(Shell::GetPrimaryRootWindow()); | |
37 if (manager) { | |
38 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | |
39 manager->SelectValueForShelfAlignment( | |
40 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | |
41 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | |
42 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, | |
43 -1), | |
44 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | |
45 } | |
46 } | |
47 | |
48 } // namespace ash | |
OLD | NEW |