| OLD | NEW |
| 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/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_delegate.h" | 10 #include "ash/shelf/shelf_delegate.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 void UserMetricsRecorder::RecordPeriodicMetrics() { | 623 void UserMetricsRecorder::RecordPeriodicMetrics() { |
| 624 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 624 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 625 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 625 // TODO(bruthig): Investigating whether the check for |manager| is necessary |
| 626 // and add tests if it is. | 626 // and add tests if it is. |
| 627 if (shelf) { | 627 if (shelf) { |
| 628 // TODO(bruthig): Consider tracking the time spent in each alignment. | 628 // TODO(bruthig): Consider tracking the time spent in each alignment. |
| 629 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 629 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
| 630 shelf->SelectValueForShelfAlignment( | 630 shelf->SelectValueForShelfAlignment( |
| 631 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 631 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
| 632 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 632 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
| 633 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, -1), | 633 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), |
| 634 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 634 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
| 635 } | 635 } |
| 636 | 636 |
| 637 if (IsUserInActiveDesktopEnvironment()) { | 637 if (IsUserInActiveDesktopEnvironment()) { |
| 638 RecordShelfItemCounts(); | 638 RecordShelfItemCounts(); |
| 639 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", | 639 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", |
| 640 GetNumVisibleWindowsInPrimaryDisplay()); | 640 GetNumVisibleWindowsInPrimaryDisplay()); |
| 641 } | 641 } |
| 642 | 642 |
| 643 // TODO(bruthig): Find out if this should only be logged when the user is | 643 // TODO(bruthig): Find out if this should only be logged when the user is |
| 644 // active. | 644 // active. |
| 645 // TODO(bruthig): Consider tracking how long a particular type of window is | 645 // TODO(bruthig): Consider tracking how long a particular type of window is |
| 646 // active at a time. | 646 // active at a time. |
| 647 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", | 647 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", |
| 648 GetActiveWindowState(), | 648 GetActiveWindowState(), |
| 649 ACTIVE_WINDOW_STATE_TYPE_COUNT); | 649 ACTIVE_WINDOW_STATE_TYPE_COUNT); |
| 650 } | 650 } |
| 651 | 651 |
| 652 bool UserMetricsRecorder::IsUserInActiveDesktopEnvironment() const { | 652 bool UserMetricsRecorder::IsUserInActiveDesktopEnvironment() const { |
| 653 return IsUserActive() && !IsKioskModeActive(); | 653 return IsUserActive() && !IsKioskModeActive(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void UserMetricsRecorder::StartTimer() { | 656 void UserMetricsRecorder::StartTimer() { |
| 657 timer_.Start(FROM_HERE, | 657 timer_.Start(FROM_HERE, |
| 658 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 658 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 659 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 659 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 660 } | 660 } |
| 661 | 661 |
| 662 } // namespace ash | 662 } // namespace ash |
| OLD | NEW |