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

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

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/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.h"
10 #include "ash/shelf/shelf_delegate.h" 10 #include "ash/shelf/shelf_delegate.h"
11 #include "ash/shelf/shelf_item_types.h" 11 #include "ash/shelf/shelf_item_types.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/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/system/tray/system_tray_delegate.h" 16 #include "ash/system/tray/system_tray_delegate.h"
17 #include "ash/wm/common/window_state.h" 17 #include "ash/wm/common/window_state.h"
18 #include "ash/wm/common/wm_user_metrics_action.h"
18 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
19 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
20 #include "base/metrics/user_metrics.h" 21 #include "base/metrics/user_metrics.h"
21 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
22 23
23 namespace ash { 24 namespace ash {
24 25
25 namespace { 26 namespace {
26 27
27 // Time in seconds between calls to "RecordPeriodicMetrics". 28 // Time in seconds between calls to "RecordPeriodicMetrics".
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 base::UserMetricsAction("Accel_ShutDown_PowerButton")); 236 base::UserMetricsAction("Accel_ShutDown_PowerButton"));
236 break; 237 break;
237 case ash::UMA_CLOSE_THROUGH_CONTEXT_MENU: 238 case ash::UMA_CLOSE_THROUGH_CONTEXT_MENU:
238 base::RecordAction(base::UserMetricsAction("CloseFromContextMenu")); 239 base::RecordAction(base::UserMetricsAction("CloseFromContextMenu"));
239 break; 240 break;
240 case ash::UMA_DESKTOP_SWITCH_TASK: 241 case ash::UMA_DESKTOP_SWITCH_TASK:
241 base::RecordAction(base::UserMetricsAction("Desktop_SwitchTask")); 242 base::RecordAction(base::UserMetricsAction("Desktop_SwitchTask"));
242 task_switch_metrics_recorder_.OnTaskSwitch( 243 task_switch_metrics_recorder_.OnTaskSwitch(
243 TaskSwitchMetricsRecorder::DESKTOP); 244 TaskSwitchMetricsRecorder::DESKTOP);
244 break; 245 break;
245 case ash::UMA_DRAG_MAXIMIZE_LEFT:
246 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeLeft"));
247 break;
248 case ash::UMA_DRAG_MAXIMIZE_RIGHT:
249 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeRight"));
250 break;
251 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE: 246 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE:
252 base::RecordAction( 247 base::RecordAction(
253 base::UserMetricsAction("Launcher_ButtonPressed_Mouse")); 248 base::UserMetricsAction("Launcher_ButtonPressed_Mouse"));
254 break; 249 break;
255 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH: 250 case ash::UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH:
256 base::RecordAction( 251 base::RecordAction(
257 base::UserMetricsAction("Launcher_ButtonPressed_Touch")); 252 base::UserMetricsAction("Launcher_ButtonPressed_Touch"));
258 break; 253 break;
259 case ash::UMA_LAUNCHER_CLICK_ON_APP: 254 case ash::UMA_LAUNCHER_CLICK_ON_APP:
260 base::RecordAction(base::UserMetricsAction("Launcher_ClickOnApp")); 255 base::RecordAction(base::UserMetricsAction("Launcher_ClickOnApp"));
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 base::RecordAction( 596 base::RecordAction(
602 base::UserMetricsAction("WindowSelector_OverviewEnterKey")); 597 base::UserMetricsAction("WindowSelector_OverviewEnterKey"));
603 break; 598 break;
604 case ash::UMA_WINDOW_CYCLE: 599 case ash::UMA_WINDOW_CYCLE:
605 base::RecordAction( 600 base::RecordAction(
606 base::UserMetricsAction("WindowCycleController_Cycle")); 601 base::UserMetricsAction("WindowCycleController_Cycle"));
607 break; 602 break;
608 } 603 }
609 } 604 }
610 605
606 void UserMetricsRecorder::RecordUserMetricsAction(
607 wm::WmUserMetricsAction action) {
608 switch (action) {
609 case wm::WmUserMetricsAction::DRAG_MAXIMIZE_LEFT:
610 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeLeft"));
611 break;
612 case wm::WmUserMetricsAction::DRAG_MAXIMIZE_RIGHT:
613 base::RecordAction(base::UserMetricsAction("WindowDrag_MaximizeRight"));
614 break;
615 }
616 }
617
611 void UserMetricsRecorder::OnShellInitialized() { 618 void UserMetricsRecorder::OnShellInitialized() {
612 // Lazy creation of the DesktopTaskSwitchMetricRecorder because it accesses 619 // Lazy creation of the DesktopTaskSwitchMetricRecorder because it accesses
613 // Shell::GetInstance() which is not available when |this| is instantiated. 620 // Shell::GetInstance() which is not available when |this| is instantiated.
614 if (!desktop_task_switch_metric_recorder_) { 621 if (!desktop_task_switch_metric_recorder_) {
615 desktop_task_switch_metric_recorder_.reset( 622 desktop_task_switch_metric_recorder_.reset(
616 new DesktopTaskSwitchMetricRecorder()); 623 new DesktopTaskSwitchMetricRecorder());
617 } 624 }
618 } 625 }
619 626
620 void UserMetricsRecorder::OnShellShuttingDown() { 627 void UserMetricsRecorder::OnShellShuttingDown() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 return IsUserActive() && !IsKioskModeActive(); 661 return IsUserActive() && !IsKioskModeActive();
655 } 662 }
656 663
657 void UserMetricsRecorder::StartTimer() { 664 void UserMetricsRecorder::StartTimer() {
658 timer_.Start(FROM_HERE, 665 timer_.Start(FROM_HERE,
659 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 666 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
660 this, &UserMetricsRecorder::RecordPeriodicMetrics); 667 this, &UserMetricsRecorder::RecordPeriodicMetrics);
661 } 668 }
662 669
663 } // namespace ash 670 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698