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/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/shelf/shelf_delegate.h" | 8 #include "ash/common/shelf/shelf_delegate.h" |
9 #include "ash/common/shelf/shelf_item_types.h" | 9 #include "ash/common/shelf/shelf_item_types.h" |
10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| 11 #include "ash/common/shelf/shelf_view.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" |
11 #include "ash/common/shell_window_ids.h" | 13 #include "ash/common/shell_window_ids.h" |
12 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
13 #include "ash/common/wm/window_state.h" | 15 #include "ash/common/wm/window_state.h" |
| 16 #include "ash/common/wm_root_window_controller.h" |
14 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 18 #include "ash/common/wm_window.h" |
15 #include "ash/metrics/desktop_task_switch_metric_recorder.h" | 19 #include "ash/metrics/desktop_task_switch_metric_recorder.h" |
16 #include "ash/shelf/shelf.h" | |
17 #include "ash/shelf/shelf_view.h" | |
18 #include "ash/shell.h" | 20 #include "ash/shell.h" |
19 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
20 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
21 #include "base/metrics/user_metrics.h" | 23 #include "base/metrics/user_metrics.h" |
22 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
23 | 25 |
24 namespace ash { | 26 namespace ash { |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 desktop_task_switch_metric_recorder_.reset( | 589 desktop_task_switch_metric_recorder_.reset( |
588 new DesktopTaskSwitchMetricRecorder()); | 590 new DesktopTaskSwitchMetricRecorder()); |
589 } | 591 } |
590 } | 592 } |
591 | 593 |
592 void UserMetricsRecorder::OnShellShuttingDown() { | 594 void UserMetricsRecorder::OnShellShuttingDown() { |
593 desktop_task_switch_metric_recorder_.reset(); | 595 desktop_task_switch_metric_recorder_.reset(); |
594 } | 596 } |
595 | 597 |
596 void UserMetricsRecorder::RecordPeriodicMetrics() { | 598 void UserMetricsRecorder::RecordPeriodicMetrics() { |
597 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 599 WmShelf* shelf = WmShell::Get() |
| 600 ->GetPrimaryRootWindow() |
| 601 ->GetRootWindowController() |
| 602 ->GetShelf(); |
598 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 603 // TODO(bruthig): Investigating whether the check for |manager| is necessary |
599 // and add tests if it is. | 604 // and add tests if it is. |
600 if (shelf) { | 605 if (shelf) { |
601 // TODO(bruthig): Consider tracking the time spent in each alignment. | 606 // TODO(bruthig): Consider tracking the time spent in each alignment. |
602 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 607 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
603 shelf->SelectValueForShelfAlignment( | 608 shelf->SelectValueForShelfAlignment( |
604 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 609 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
605 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 610 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
606 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), | 611 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), |
607 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 612 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); |
(...skipping 18 matching lines...) Expand all Loading... |
626 return IsUserActive() && !IsKioskModeActive(); | 631 return IsUserActive() && !IsKioskModeActive(); |
627 } | 632 } |
628 | 633 |
629 void UserMetricsRecorder::StartTimer() { | 634 void UserMetricsRecorder::StartTimer() { |
630 timer_.Start(FROM_HERE, | 635 timer_.Start(FROM_HERE, |
631 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 636 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
632 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 637 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
633 } | 638 } |
634 | 639 |
635 } // namespace ash | 640 } // namespace ash |
OLD | NEW |