| 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/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 10 #include "ash/wm_shell.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 static_cast<base::HistogramBase::Sample>(input_type), | 81 static_cast<base::HistogramBase::Sample>(input_type), |
| 82 static_cast<base::HistogramBase::Sample>(DownEventSource::SOURCE_COUNT)); | 82 static_cast<base::HistogramBase::Sample>(DownEventSource::SOURCE_COUNT)); |
| 83 | 83 |
| 84 UMA_HISTOGRAM_ENUMERATION("Event.DownEventCount.PerDestination", | 84 UMA_HISTOGRAM_ENUMERATION("Event.DownEventCount.PerDestination", |
| 85 GetDestination(target), kAppCount); | 85 GetDestination(target), kAppCount); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 PointerMetricsRecorder::PointerMetricsRecorder() { | 90 PointerMetricsRecorder::PointerMetricsRecorder() { |
| 91 ash::WmShell::Get()->AddPointerWatcher( | 91 ShellPort::Get()->AddPointerWatcher(this, |
| 92 this, views::PointerWatcherEventTypes::BASIC); | 92 views::PointerWatcherEventTypes::BASIC); |
| 93 } | 93 } |
| 94 | 94 |
| 95 PointerMetricsRecorder::~PointerMetricsRecorder() { | 95 PointerMetricsRecorder::~PointerMetricsRecorder() { |
| 96 ash::WmShell::Get()->RemovePointerWatcher(this); | 96 ShellPort::Get()->RemovePointerWatcher(this); |
| 97 } | 97 } |
| 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 |