1 // Copyright 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.
5 #include "ash/periodic_metrics_recorder.h"
7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shelf/shelf_view.h"
9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h"
11 #include "base/metrics/histogram.h"
15 // Time in seconds between calls to "RecordMetrics".
16 const int kAshPeriodicMetricsTimeInSeconds
= 30 * 60;
18 PeriodicMetricsRecorder::PeriodicMetricsRecorder() {
19 timer_
.Start(FROM_HERE
,
20 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds
),
22 &PeriodicMetricsRecorder::RecordMetrics
);
25 PeriodicMetricsRecorder::~PeriodicMetricsRecorder() {
29 void PeriodicMetricsRecorder::RecordMetrics() {
30 internal::ShelfLayoutManager
* manager
=
31 internal::ShelfLayoutManager::ForLauncher(Shell::GetPrimaryRootWindow());
33 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
34 manager
->SelectValueForShelfAlignment(
35 internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM
,
36 internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT
,
37 internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT
,
39 internal::SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT
);