Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: ash/periodic_metrics_recorder.cc

Issue 26373009: ash:Shelf - Added UMA stats for ShelfAlignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits & things Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/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 kAshPeriodicMetricsTimeInSeconds = 30 * 60;
22
23 AshPeriodicMetricsRecorder::AshPeriodicMetricsRecorder() {
24 timer_.Start(FROM_HERE,
25 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
26 this,
27 &AshPeriodicMetricsRecorder::RecordMetrics);
28 }
29
30 AshPeriodicMetricsRecorder::~AshPeriodicMetricsRecorder() {
31 timer_.Stop();
32 }
33
34 void AshPeriodicMetricsRecorder::RecordMetrics() {
35 internal::ShelfLayoutManager* manager =
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698