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

Side by Side Diff: ash/common/metrics/pointer_metrics_recorder.cc

Issue 2766543002: Move even more from WmShell to Shell (Closed)
Patch Set: Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/metrics/pointer_metrics_recorder.h" 5 #include "ash/common/metrics/pointer_metrics_recorder.h"
6 6
7 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 7 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/shared/app_types.h" 10 #include "ash/shared/app_types.h"
11 #include "ash/shell.h"
11 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
12 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 15
15 namespace ash { 16 namespace ash {
16 17
17 namespace { 18 namespace {
18 19
19 // Form factor of the down event. This enum is used to back an UMA histogram 20 // Form factor of the down event. This enum is used to back an UMA histogram
20 // and new values should be inserted immediately above FORM_FACTOR_COUNT. 21 // and new values should be inserted immediately above FORM_FACTOR_COUNT.
(...skipping 17 matching lines...) Expand all
38 if (!target) 39 if (!target)
39 return static_cast<int>(AppType::OTHERS); 40 return static_cast<int>(AppType::OTHERS);
40 41
41 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); 42 WmWindow* window = WmWindow::Get(target->GetNativeWindow());
42 DCHECK(window); 43 DCHECK(window);
43 return window->GetAppType(); 44 return window->GetAppType();
44 } 45 }
45 46
46 void RecordUMA(ui::EventPointerType type, views::Widget* target) { 47 void RecordUMA(ui::EventPointerType type, views::Widget* target) {
47 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL; 48 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL;
48 if (ash::WmShell::Get() 49 if (Shell::Get()
49 ->maximize_mode_controller() 50 ->maximize_mode_controller()
50 ->IsMaximizeModeWindowManagerEnabled()) { 51 ->IsMaximizeModeWindowManagerEnabled()) {
51 form_factor = DownEventFormFactor::TOUCH_VIEW; 52 form_factor = DownEventFormFactor::TOUCH_VIEW;
52 } 53 }
53 UMA_HISTOGRAM_ENUMERATION( 54 UMA_HISTOGRAM_ENUMERATION(
54 "Event.DownEventCount.PerFormFactor", 55 "Event.DownEventCount.PerFormFactor",
55 static_cast<base::HistogramBase::Sample>(form_factor), 56 static_cast<base::HistogramBase::Sample>(form_factor),
56 static_cast<base::HistogramBase::Sample>( 57 static_cast<base::HistogramBase::Sample>(
57 DownEventFormFactor::FORM_FACTOR_COUNT)); 58 DownEventFormFactor::FORM_FACTOR_COUNT));
58 59
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 void PointerMetricsRecorder::OnPointerEventObserved( 99 void PointerMetricsRecorder::OnPointerEventObserved(
99 const ui::PointerEvent& event, 100 const ui::PointerEvent& event,
100 const gfx::Point& location_in_screen, 101 const gfx::Point& location_in_screen,
101 views::Widget* target) { 102 views::Widget* target) {
102 if (event.type() == ui::ET_POINTER_DOWN) 103 if (event.type() == ui::ET_POINTER_DOWN)
103 RecordUMA(event.pointer_details().pointer_type, target); 104 RecordUMA(event.pointer_details().pointer_type, target);
104 } 105 }
105 106
106 } // namespace ash 107 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/frame/custom_frame_view_ash_unittest.cc ('k') | ash/common/metrics/pointer_metrics_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698