Chromium Code Reviews| 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" | 17 #include "ash/shell_port.h" | 
| 
 
James Cook
2017/05/17 23:41:49
still needed?
(you might want to audit other file
 
msw
2017/05/18 20:28:00
Done, and audit found one more I removed.
 
 | |
| 18 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" | 
| 19 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.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 | 
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 void UserMetricsRecorder::OnShellShuttingDown() { | 619 void UserMetricsRecorder::OnShellShuttingDown() { | 
| 620 desktop_task_switch_metric_recorder_.reset(); | 620 desktop_task_switch_metric_recorder_.reset(); | 
| 621 | 621 | 
| 622 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is | 622 // To clean up pointer_metrics_recorder_ properly, a valid shell instance is | 
| 623 // required, so explicitly delete it before the shell instance becomes | 623 // required, so explicitly delete it before the shell instance becomes | 
| 624 // invalid. | 624 // invalid. | 
| 625 pointer_metrics_recorder_.reset(); | 625 pointer_metrics_recorder_.reset(); | 
| 626 } | 626 } | 
| 627 | 627 | 
| 628 void UserMetricsRecorder::RecordPeriodicMetrics() { | 628 void UserMetricsRecorder::RecordPeriodicMetrics() { | 
| 629 WmShelf* shelf = WmShelf::ForWindow(ShellPort::Get()->GetPrimaryRootWindow()); | 629 WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow()); | 
| 630 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 630 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 
| 631 // and add tests if it is. | 631 // and add tests if it is. | 
| 632 if (shelf) { | 632 if (shelf) { | 
| 633 // TODO(bruthig): Consider tracking the time spent in each alignment. | 633 // TODO(bruthig): Consider tracking the time spent in each alignment. | 
| 634 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 634 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 
| 635 shelf->SelectValueForShelfAlignment( | 635 shelf->SelectValueForShelfAlignment( | 
| 636 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 636 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 
| 637 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 637 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 
| 638 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), | 638 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), | 
| 639 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 639 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); | 
| (...skipping 18 matching lines...) Expand all Loading... | |
| 658 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); | 658 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); | 
| 659 } | 659 } | 
| 660 | 660 | 
| 661 void UserMetricsRecorder::StartTimer() { | 661 void UserMetricsRecorder::StartTimer() { | 
| 662 timer_.Start(FROM_HERE, | 662 timer_.Start(FROM_HERE, | 
| 663 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 663 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 
| 664 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 664 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 
| 665 } | 665 } | 
| 666 | 666 | 
| 667 } // namespace ash | 667 } // namespace ash | 
| OLD | NEW |