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

Unified Diff: ash/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: copywrite header Created 7 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: ash/ash_periodic_metrics_recorder.cc
diff --git a/ash/ash_periodic_metrics_recorder.cc b/ash/ash_periodic_metrics_recorder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c31d914a1cce43bab2a6823cfd7bb2c9b06b0ea7
--- /dev/null
+++ b/ash/ash_periodic_metrics_recorder.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/ash_periodic_metrics_recorder.h"
+
+#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_widget.h"
+#include "ash/shell.h"
+#include "base/metrics/histogram.h"
+
+namespace ash {
+namespace {
+const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0;
+const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1;
+const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2;
+const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3;
+}
+
+// Time in seconds between calls to "RecordMetrics".
+const int kAshPeridicMetricsTimeInSeconds = 1 * 60;
James Cook 2013/11/01 00:28:51 Peridic -> Periodic
Harry McCleave 2013/11/01 01:00:38 Done.
+
+AshPeriodicMetricsRecorder::AshPeriodicMetricsRecorder() {
+ timer_.Start(FROM_HERE,
+ base::TimeDelta::FromSeconds(kAshPeridicMetricsTimeInSeconds),
+ this,
+ &AshPeriodicMetricsRecorder::RecordMetrics);
+}
+
+AshPeriodicMetricsRecorder::~AshPeriodicMetricsRecorder() {
+ timer_.Stop();
+}
+
+void AshPeriodicMetricsRecorder::RecordMetrics() {
+ internal::ShelfLayoutManager *manager =
James Cook 2013/11/01 00:28:51 nit: * on left
Harry McCleave 2013/11/01 01:00:38 Done.
+ internal::ShelfLayoutManager::ForLauncher(Shell::GetPrimaryRootWindow());
+ if (manager) {
+ UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
+ manager->SelectValueForShelfAlignment(
+ SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
+ SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
+ SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT,
+ -1),
+ SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
+ }
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698