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_state_delegate.h" | 11 #include "ash/session/session_state_delegate.h" |
12 #include "ash/shelf/shelf_model.h" | 12 #include "ash/shelf/shelf_model.h" |
13 #include "ash/shelf/shelf_view.h" | 13 #include "ash/shelf/shelf_view.h" |
14 #include "ash/shelf/wm_shelf.h" | 14 #include "ash/shelf/wm_shelf.h" |
15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_port.h" |
16 #include "ash/system/tray/system_tray_delegate.h" | 17 #include "ash/system/tray/system_tray_delegate.h" |
17 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
18 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.h" |
19 #include "ash/wm_shell.h" | |
20 #include "ash/wm_window.h" | 20 #include "ash/wm_window.h" |
21 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
22 #include "base/metrics/histogram_macros.h" | 22 #include "base/metrics/histogram_macros.h" |
23 #include "base/metrics/user_metrics.h" | 23 #include "base/metrics/user_metrics.h" |
24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 void UserMetricsRecorder::OnShellShuttingDown() { | 629 void UserMetricsRecorder::OnShellShuttingDown() { |
630 desktop_task_switch_metric_recorder_.reset(); | 630 desktop_task_switch_metric_recorder_.reset(); |
631 | 631 |
632 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is | 632 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is |
633 // required, so explicitly delete it before the shell instance becomes | 633 // required, so explicitly delete it before the shell instance becomes |
634 // invalid. | 634 // invalid. |
635 pointer_metrics_recorder_.reset(); | 635 pointer_metrics_recorder_.reset(); |
636 } | 636 } |
637 | 637 |
638 void UserMetricsRecorder::RecordPeriodicMetrics() { | 638 void UserMetricsRecorder::RecordPeriodicMetrics() { |
639 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); | 639 WmShelf* shelf = WmShelf::ForWindow(ShellPort::Get()->GetPrimaryRootWindow()); |
640 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 640 // TODO(bruthig): Investigating whether the check for |manager| is necessary |
641 // and add tests if it is. | 641 // and add tests if it is. |
642 if (shelf) { | 642 if (shelf) { |
643 // TODO(bruthig): Consider tracking the time spent in each alignment. | 643 // TODO(bruthig): Consider tracking the time spent in each alignment. |
644 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 644 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
645 shelf->SelectValueForShelfAlignment( | 645 shelf->SelectValueForShelfAlignment( |
646 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 646 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
647 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 647 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
648 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), | 648 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), |
649 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 649 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
(...skipping 18 matching lines...) Expand all Loading... |
668 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); | 668 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); |
669 } | 669 } |
670 | 670 |
671 void UserMetricsRecorder::StartTimer() { | 671 void UserMetricsRecorder::StartTimer() { |
672 timer_.Start(FROM_HERE, | 672 timer_.Start(FROM_HERE, |
673 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 673 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
674 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 674 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
675 } | 675 } |
676 | 676 |
677 } // namespace ash | 677 } // namespace ash |
OLD | NEW |