| 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/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 Loading... |
| 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 |
| OLD | NEW |