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

Side by Side Diff: ash/metrics/user_metrics_recorder.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/shelf/shelf_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #include "ash/metrics/user_metrics_recorder.h" 5 #include "ash/metrics/user_metrics_recorder.h"
6 6
7 #include "ash/metrics/desktop_task_switch_metric_recorder.h" 7 #include "ash/metrics/desktop_task_switch_metric_recorder.h"
8 #include "ash/metrics/pointer_metrics_recorder.h" 8 #include "ash/metrics/pointer_metrics_recorder.h"
9 #include "ash/public/cpp/shelf_item.h" 9 #include "ash/public/cpp/shelf_item.h"
10 #include "ash/public/cpp/shelf_model.h" 10 #include "ash/public/cpp/shelf_model.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 pointer_metrics_recorder_.reset(); 543 pointer_metrics_recorder_.reset();
544 } 544 }
545 545
546 void UserMetricsRecorder::RecordPeriodicMetrics() { 546 void UserMetricsRecorder::RecordPeriodicMetrics() {
547 Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow()); 547 Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow());
548 // TODO(bruthig): Investigating whether the check for |manager| is necessary 548 // TODO(bruthig): Investigating whether the check for |manager| is necessary
549 // and add tests if it is. 549 // and add tests if it is.
550 if (shelf) { 550 if (shelf) {
551 // TODO(bruthig): Consider tracking the time spent in each alignment. 551 // TODO(bruthig): Consider tracking the time spent in each alignment.
552 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", 552 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
553 shelf->SelectValueForShelfAlignment( 553 static_cast<ShelfAlignmentUmaEnumValue>(
554 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, 554 shelf->SelectValueForShelfAlignment(
555 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, 555 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
556 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), 556 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
557 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT)),
557 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); 558 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
558 } 559 }
559 560
560 if (IsUserInActiveDesktopEnvironment()) { 561 if (IsUserInActiveDesktopEnvironment()) {
561 RecordShelfItemCounts(); 562 RecordShelfItemCounts();
562 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", 563 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay",
563 GetNumVisibleWindowsInPrimaryDisplay()); 564 GetNumVisibleWindowsInPrimaryDisplay());
564 } 565 }
565 566
566 // TODO(bruthig): Find out if this should only be logged when the user is 567 // TODO(bruthig): Find out if this should only be logged when the user is
567 // active. 568 // active.
568 // TODO(bruthig): Consider tracking how long a particular type of window is 569 // TODO(bruthig): Consider tracking how long a particular type of window is
569 // active at a time. 570 // active at a time.
570 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", 571 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime",
571 GetActiveWindowState(), 572 GetActiveWindowState(),
572 ACTIVE_WINDOW_STATE_TYPE_COUNT); 573 ACTIVE_WINDOW_STATE_TYPE_COUNT);
573 } 574 }
574 575
575 bool UserMetricsRecorder::IsUserInActiveDesktopEnvironment() const { 576 bool UserMetricsRecorder::IsUserInActiveDesktopEnvironment() const {
576 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); 577 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive();
577 } 578 }
578 579
579 void UserMetricsRecorder::StartTimer() { 580 void UserMetricsRecorder::StartTimer() {
580 timer_.Start(FROM_HERE, 581 timer_.Start(FROM_HERE,
581 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 582 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
582 this, &UserMetricsRecorder::RecordPeriodicMetrics); 583 this, &UserMetricsRecorder::RecordPeriodicMetrics);
583 } 584 }
584 585
585 } // namespace ash 586 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698