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

Side by Side Diff: ash/shelf/shelf_button_pressed_metric_tracker.cc

Issue 2099443002: Migrate simple ash Shell metrics users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile error. Created 4 years, 6 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
« no previous file with comments | « ash/metrics/desktop_task_switch_metric_recorder.cc ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/shelf/shelf_button_pressed_metric_tracker.h" 5 #include "ash/shelf/shelf_button_pressed_metric_tracker.h"
6 6
7 #include "ash/metrics/user_metrics_recorder.h" 7 #include "ash/common/wm_shell.h"
8 #include "ash/shell.h"
9 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
10 #include "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
11 #include "ui/views/controls/button/button.h" 10 #include "ui/views/controls/button/button.h"
12 11
13 namespace ash { 12 namespace ash {
14 13
15 const char ShelfButtonPressedMetricTracker:: 14 const char ShelfButtonPressedMetricTracker::
16 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[] = 15 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[] =
17 "Ash.Shelf.TimeBetweenWindowMinimizedAndActivatedActions"; 16 "Ash.Shelf.TimeBetweenWindowMinimizedAndActivatedActions";
18 17
(...skipping 25 matching lines...) Expand all
44 break; 43 break;
45 } 44 }
46 45
47 if (performed_action != ShelfItemDelegate::kExistingWindowMinimized) 46 if (performed_action != ShelfItemDelegate::kExistingWindowMinimized)
48 ResetMinimizedData(); 47 ResetMinimizedData();
49 } 48 }
50 49
51 void ShelfButtonPressedMetricTracker::RecordButtonPressedSource( 50 void ShelfButtonPressedMetricTracker::RecordButtonPressedSource(
52 const ui::Event& event) { 51 const ui::Event& event) {
53 if (event.IsMouseEvent()) { 52 if (event.IsMouseEvent()) {
54 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 53 WmShell::Get()->RecordUserMetricsAction(
55 UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE); 54 UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE);
56 } else if (event.IsGestureEvent()) { 55 } else if (event.IsGestureEvent()) {
57 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 56 WmShell::Get()->RecordUserMetricsAction(
58 UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH); 57 UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH);
59 } 58 }
60 } 59 }
61 60
62 void ShelfButtonPressedMetricTracker::RecordButtonPressedAction( 61 void ShelfButtonPressedMetricTracker::RecordButtonPressedAction(
63 ShelfItemDelegate::PerformedAction performed_action) { 62 ShelfItemDelegate::PerformedAction performed_action) {
64 switch (performed_action) { 63 switch (performed_action) {
65 case ShelfItemDelegate::kNoAction: 64 case ShelfItemDelegate::kNoAction:
66 case ShelfItemDelegate::kAppListMenuShown: 65 case ShelfItemDelegate::kAppListMenuShown:
67 break; 66 break;
68 case ShelfItemDelegate::kNewWindowCreated: 67 case ShelfItemDelegate::kNewWindowCreated:
69 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 68 WmShell::Get()->RecordUserMetricsAction(UMA_LAUNCHER_LAUNCH_TASK);
70 UMA_LAUNCHER_LAUNCH_TASK);
71 break; 69 break;
72 case ShelfItemDelegate::kExistingWindowActivated: 70 case ShelfItemDelegate::kExistingWindowActivated:
73 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 71 WmShell::Get()->RecordUserMetricsAction(UMA_LAUNCHER_SWITCH_TASK);
74 UMA_LAUNCHER_SWITCH_TASK);
75 break; 72 break;
76 case ShelfItemDelegate::kExistingWindowMinimized: 73 case ShelfItemDelegate::kExistingWindowMinimized:
77 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 74 WmShell::Get()->RecordUserMetricsAction(UMA_LAUNCHER_MINIMIZE_TASK);
78 UMA_LAUNCHER_MINIMIZE_TASK);
79 break; 75 break;
80 } 76 }
81 } 77 }
82 78
83 void ShelfButtonPressedMetricTracker::RecordTimeBetweenMinimizedAndActivated() { 79 void ShelfButtonPressedMetricTracker::RecordTimeBetweenMinimizedAndActivated() {
84 UMA_HISTOGRAM_TIMES( 80 UMA_HISTOGRAM_TIMES(
85 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 81 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName,
86 tick_clock_->NowTicks() - time_of_last_minimize_); 82 tick_clock_->NowTicks() - time_of_last_minimize_);
87 } 83 }
88 84
89 bool ShelfButtonPressedMetricTracker::IsSubsequentActivationEvent( 85 bool ShelfButtonPressedMetricTracker::IsSubsequentActivationEvent(
90 const views::Button* sender) const { 86 const views::Button* sender) const {
91 return time_of_last_minimize_ != base::TimeTicks() && 87 return time_of_last_minimize_ != base::TimeTicks() &&
92 last_minimized_source_button_ == sender; 88 last_minimized_source_button_ == sender;
93 } 89 }
94 90
95 void ShelfButtonPressedMetricTracker::SetMinimizedData( 91 void ShelfButtonPressedMetricTracker::SetMinimizedData(
96 const views::Button* sender) { 92 const views::Button* sender) {
97 last_minimized_source_button_ = sender; 93 last_minimized_source_button_ = sender;
98 time_of_last_minimize_ = tick_clock_->NowTicks(); 94 time_of_last_minimize_ = tick_clock_->NowTicks();
99 } 95 }
100 96
101 void ShelfButtonPressedMetricTracker::ResetMinimizedData() { 97 void ShelfButtonPressedMetricTracker::ResetMinimizedData() {
102 last_minimized_source_button_ = nullptr; 98 last_minimized_source_button_ = nullptr;
103 time_of_last_minimize_ = base::TimeTicks(); 99 time_of_last_minimize_ = base::TimeTicks();
104 } 100 }
105 101
106 } // namespace ash 102 } // namespace ash
OLDNEW
« no previous file with comments | « ash/metrics/desktop_task_switch_metric_recorder.cc ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698