| 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/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_lookup.h" | |
| 9 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 11 #include "ash/shared/app_types.h" | 10 #include "ash/shared/app_types.h" |
| 12 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 13 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
| 14 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 15 | 14 |
| 16 namespace ash { | 15 namespace ash { |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 MOUSE, | 31 MOUSE, |
| 33 STYLUS, | 32 STYLUS, |
| 34 TOUCH, | 33 TOUCH, |
| 35 SOURCE_COUNT, | 34 SOURCE_COUNT, |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 int GetDestination(views::Widget* target) { | 37 int GetDestination(views::Widget* target) { |
| 39 if (!target) | 38 if (!target) |
| 40 return static_cast<int>(AppType::OTHERS); | 39 return static_cast<int>(AppType::OTHERS); |
| 41 | 40 |
| 42 WmWindow* window = WmLookup::Get()->GetWindowForWidget(target); | 41 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); |
| 43 DCHECK(window); | 42 DCHECK(window); |
| 44 return window->GetAppType(); | 43 return window->GetAppType(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void RecordUMA(ui::EventPointerType type, views::Widget* target) { | 46 void RecordUMA(ui::EventPointerType type, views::Widget* target) { |
| 48 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL; | 47 DownEventFormFactor form_factor = DownEventFormFactor::CLAMSHELL; |
| 49 if (ash::WmShell::Get() | 48 if (ash::WmShell::Get() |
| 50 ->maximize_mode_controller() | 49 ->maximize_mode_controller() |
| 51 ->IsMaximizeModeWindowManagerEnabled()) { | 50 ->IsMaximizeModeWindowManagerEnabled()) { |
| 52 form_factor = DownEventFormFactor::TOUCH_VIEW; | 51 form_factor = DownEventFormFactor::TOUCH_VIEW; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 97 |
| 99 void PointerMetricsRecorder::OnPointerEventObserved( | 98 void PointerMetricsRecorder::OnPointerEventObserved( |
| 100 const ui::PointerEvent& event, | 99 const ui::PointerEvent& event, |
| 101 const gfx::Point& location_in_screen, | 100 const gfx::Point& location_in_screen, |
| 102 views::Widget* target) { | 101 views::Widget* target) { |
| 103 if (event.type() == ui::ET_POINTER_DOWN) | 102 if (event.type() == ui::ET_POINTER_DOWN) |
| 104 RecordUMA(event.pointer_details().pointer_type, target); | 103 RecordUMA(event.pointer_details().pointer_type, target); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace ash | 106 } // namespace ash |
| OLD | NEW |