Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: ash/metrics/user_metrics_recorder.cc

Issue 2293183002: ash: Remove ash::Shelf in favor of ash::WmShelf (Closed)
Patch Set: rebase again Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 11 #include "ash/common/shelf/shelf_view.h"
12 #include "ash/common/shelf/wm_shelf.h" 12 #include "ash/common/shelf/wm_shelf.h"
13 #include "ash/common/shell_window_ids.h" 13 #include "ash/common/shell_window_ids.h"
14 #include "ash/common/system/tray/system_tray_delegate.h" 14 #include "ash/common/system/tray/system_tray_delegate.h"
15 #include "ash/common/wm/window_state.h" 15 #include "ash/common/wm/window_state.h"
16 #include "ash/common/wm_root_window_controller.h"
17 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 17 #include "ash/common/wm_window.h"
19 #include "ash/metrics/desktop_task_switch_metric_recorder.h" 18 #include "ash/metrics/desktop_task_switch_metric_recorder.h"
20 #include "ash/shell.h" 19 #include "ash/shell.h"
21 #include "ash/wm/window_state_aura.h" 20 #include "ash/wm/window_state_aura.h"
22 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.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 {
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 desktop_task_switch_metric_recorder_.reset( 588 desktop_task_switch_metric_recorder_.reset(
590 new DesktopTaskSwitchMetricRecorder()); 589 new DesktopTaskSwitchMetricRecorder());
591 } 590 }
592 } 591 }
593 592
594 void UserMetricsRecorder::OnShellShuttingDown() { 593 void UserMetricsRecorder::OnShellShuttingDown() {
595 desktop_task_switch_metric_recorder_.reset(); 594 desktop_task_switch_metric_recorder_.reset();
596 } 595 }
597 596
598 void UserMetricsRecorder::RecordPeriodicMetrics() { 597 void UserMetricsRecorder::RecordPeriodicMetrics() {
599 WmShelf* shelf = WmShell::Get() 598 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow());
600 ->GetPrimaryRootWindow()
601 ->GetRootWindowController()
602 ->GetShelf();
603 // TODO(bruthig): Investigating whether the check for |manager| is necessary 599 // TODO(bruthig): Investigating whether the check for |manager| is necessary
604 // and add tests if it is. 600 // and add tests if it is.
605 if (shelf) { 601 if (shelf) {
606 // TODO(bruthig): Consider tracking the time spent in each alignment. 602 // TODO(bruthig): Consider tracking the time spent in each alignment.
607 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", 603 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime",
608 shelf->SelectValueForShelfAlignment( 604 shelf->SelectValueForShelfAlignment(
609 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, 605 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
610 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, 606 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
611 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT), 607 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT),
612 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); 608 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
(...skipping 18 matching lines...) Expand all
631 return IsUserActive() && !IsKioskModeActive(); 627 return IsUserActive() && !IsKioskModeActive();
632 } 628 }
633 629
634 void UserMetricsRecorder::StartTimer() { 630 void UserMetricsRecorder::StartTimer() {
635 timer_.Start(FROM_HERE, 631 timer_.Start(FROM_HERE,
636 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 632 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
637 this, &UserMetricsRecorder::RecordPeriodicMetrics); 633 this, &UserMetricsRecorder::RecordPeriodicMetrics);
638 } 634 }
639 635
640 } // namespace ash 636 } // namespace ash
OLDNEW
« no previous file with comments | « ash/focus_cycler_unittest.cc ('k') | ash/mus/accelerators/accelerator_controller_delegate_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698