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/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
12 #include "ash/session/session_state_delegate.h" | 12 #include "ash/session/session_state_delegate.h" |
13 #include "ash/shelf/shelf_model.h" | 13 #include "ash/shelf/shelf_model.h" |
14 #include "ash/shelf/shelf_view.h" | 14 #include "ash/shelf/shelf_view.h" |
15 #include "ash/shelf/wm_shelf.h" | 15 #include "ash/shelf/wm_shelf.h" |
16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
17 #include "ash/shell_port.h" | |
18 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
19 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
20 #include "ash/wm_window.h" | 19 #include "ash/wm_window.h" |
21 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
22 #include "base/metrics/histogram_macros.h" | 21 #include "base/metrics/histogram_macros.h" |
23 #include "base/metrics/user_metrics.h" | 22 #include "base/metrics/user_metrics.h" |
24 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
25 | 24 |
26 namespace ash { | 25 namespace ash { |
27 | 26 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 void UserMetricsRecorder::OnShellShuttingDown() { | 618 void UserMetricsRecorder::OnShellShuttingDown() { |
620 desktop_task_switch_metric_recorder_.reset(); | 619 desktop_task_switch_metric_recorder_.reset(); |
621 | 620 |
622 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is | 621 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is |
623 // required, so explicitly delete it before the shell instance becomes | 622 // required, so explicitly delete it before the shell instance becomes |
624 // invalid. | 623 // invalid. |
625 pointer_metrics_recorder_.reset(); | 624 pointer_metrics_recorder_.reset(); |
626 } | 625 } |
627 | 626 |
628 void UserMetricsRecorder::RecordPeriodicMetrics() { | 627 void UserMetricsRecorder::RecordPeriodicMetrics() { |
629 WmShelf* shelf = WmShelf::ForWindow(ShellPort::Get()->GetPrimaryRootWindow()); | 628 WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow()); |
630 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 629 // TODO(bruthig): Investigating whether the check for |manager| is necessary |
631 // and add tests if it is. | 630 // and add tests if it is. |
632 if (shelf) { | 631 if (shelf) { |
633 // TODO(bruthig): Consider tracking the time spent in each alignment. | 632 // TODO(bruthig): Consider tracking the time spent in each alignment. |
634 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 633 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
635 shelf->SelectValueForShelfAlignment( | 634 shelf->SelectValueForShelfAlignment( |
636 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 635 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
637 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 636 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
638 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), | 637 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), |
639 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 638 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
(...skipping 18 matching lines...) Expand all Loading... |
658 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); | 657 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); |
659 } | 658 } |
660 | 659 |
661 void UserMetricsRecorder::StartTimer() { | 660 void UserMetricsRecorder::StartTimer() { |
662 timer_.Start(FROM_HERE, | 661 timer_.Start(FROM_HERE, |
663 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 662 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
664 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 663 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
665 } | 664 } |
666 | 665 |
667 } // namespace ash | 666 } // namespace ash |
OLD | NEW |