| 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/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_delegate.h" | 10 #include "ash/shelf/shelf_delegate.h" |
| 10 #include "ash/shelf/shelf_item_types.h" | 11 #include "ash/shelf/shelf_item_types.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shelf/shelf_model.h" | 13 #include "ash/shelf/shelf_model.h" |
| 13 #include "ash/shelf/shelf_view.h" | 14 #include "ash/shelf/shelf_view.h" |
| 14 #include "ash/shelf/shelf_widget.h" | |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
| 17 #include "ash/system/tray/system_tray_delegate.h" | 17 #include "ash/system/tray/system_tray_delegate.h" |
| 18 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
| 19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 20 #include "base/metrics/user_metrics.h" | 20 #include "base/metrics/user_metrics.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 new DesktopTaskSwitchMetricRecorder()); | 616 new DesktopTaskSwitchMetricRecorder()); |
| 617 } | 617 } |
| 618 } | 618 } |
| 619 | 619 |
| 620 void UserMetricsRecorder::OnShellShuttingDown() { | 620 void UserMetricsRecorder::OnShellShuttingDown() { |
| 621 desktop_task_switch_metric_recorder_.reset(); | 621 desktop_task_switch_metric_recorder_.reset(); |
| 622 } | 622 } |
| 623 | 623 |
| 624 void UserMetricsRecorder::RecordPeriodicMetrics() { | 624 void UserMetricsRecorder::RecordPeriodicMetrics() { |
| 625 ShelfLayoutManager* manager = | 625 ShelfLayoutManager* manager = |
| 626 ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()); | 626 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); |
| 627 // TODO(bruthig): Investigating whether the check for |manager| is necessary | 627 // TODO(bruthig): Investigating whether the check for |manager| is necessary |
| 628 // and add tests if it is. | 628 // and add tests if it is. |
| 629 if (manager) { | 629 if (manager) { |
| 630 // TODO(bruthig): Consider tracking the time spent in each alignment. | 630 // TODO(bruthig): Consider tracking the time spent in each alignment. |
| 631 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", | 631 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", |
| 632 manager->SelectValueForShelfAlignment( | 632 manager->SelectValueForShelfAlignment( |
| 633 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 633 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
| 634 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 634 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
| 635 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, | 635 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, |
| 636 -1), | 636 -1), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 656 return IsUserActive() && !IsKioskModeActive(); | 656 return IsUserActive() && !IsKioskModeActive(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void UserMetricsRecorder::StartTimer() { | 659 void UserMetricsRecorder::StartTimer() { |
| 660 timer_.Start(FROM_HERE, | 660 timer_.Start(FROM_HERE, |
| 661 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 661 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 662 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 662 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 663 } | 663 } |
| 664 | 664 |
| 665 } // namespace ash | 665 } // namespace ash |
| OLD | NEW |