OLD | NEW |
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/metrics/pointer_metrics_recorder.h" | 5 #include "ash/metrics/pointer_metrics_recorder.h" |
6 | 6 |
7 #include "ash/shared/app_types.h" | 7 #include "ash/shared/app_types.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_port.h" | 9 #include "ash/shell_port.h" |
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
11 #include "ash/wm_window.h" | 11 #include "ash/wm_window.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "ui/events/event_constants.h" | 13 #include "ui/events/event_constants.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // 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 |
(...skipping 19 matching lines...) Expand all Loading... |
40 return static_cast<int>(AppType::OTHERS); | 40 return static_cast<int>(AppType::OTHERS); |
41 | 41 |
42 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); | 42 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); |
43 DCHECK(window); | 43 DCHECK(window); |
44 return window->GetAppType(); | 44 return window->GetAppType(); |
45 } | 45 } |
46 | 46 |
47 void RecordUMA(ui::EventPointerType type, views::Widget* target) { | 47 void RecordUMA(ui::EventPointerType type, views::Widget* target) { |
48 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL; | 48 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL; |
49 if (Shell::Get() | 49 if (Shell::Get() |
50 ->maximize_mode_controller() | 50 ->tablet_mode_controller() |
51 ->IsMaximizeModeWindowManagerEnabled()) { | 51 ->IsTabletModeWindowManagerEnabled()) { |
52 form_factor = DownEventFormFactor::TOUCH_VIEW; | 52 form_factor = DownEventFormFactor::TOUCH_VIEW; |
53 } | 53 } |
54 UMA_HISTOGRAM_ENUMERATION( | 54 UMA_HISTOGRAM_ENUMERATION( |
55 "Event.DownEventCount.PerFormFactor", | 55 "Event.DownEventCount.PerFormFactor", |
56 static_cast<base::HistogramBase::Sample>(form_factor), | 56 static_cast<base::HistogramBase::Sample>(form_factor), |
57 static_cast<base::HistogramBase::Sample>( | 57 static_cast<base::HistogramBase::Sample>( |
58 DownEventFormFactor::FORM_FACTOR_COUNT)); | 58 DownEventFormFactor::FORM_FACTOR_COUNT)); |
59 | 59 |
60 DownEventSource input_type = DownEventSource::UNKNOWN; | 60 DownEventSource input_type = DownEventSource::UNKNOWN; |
61 switch (type) { | 61 switch (type) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void PointerMetricsRecorder::OnPointerEventObserved( | 99 void PointerMetricsRecorder::OnPointerEventObserved( |
100 const ui::PointerEvent& event, | 100 const ui::PointerEvent& event, |
101 const gfx::Point& location_in_screen, | 101 const gfx::Point& location_in_screen, |
102 views::Widget* target) { | 102 views::Widget* target) { |
103 if (event.type() == ui::ET_POINTER_DOWN) | 103 if (event.type() == ui::ET_POINTER_DOWN) |
104 RecordUMA(event.pointer_details().pointer_type, target); | 104 RecordUMA(event.pointer_details().pointer_type, target); |
105 } | 105 } |
106 | 106 |
107 } // namespace ash | 107 } // namespace ash |
OLD | NEW |