| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/gestures/overview_gesture_handler.h" | 5 #include "ash/wm/gestures/overview_gesture_handler.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/coordinate_conversion.h" | 9 #include "ash/wm/coordinate_conversion.h" |
| 10 #include "ash/wm/overview/window_selector_controller.h" | 10 #include "ash/wm/overview/window_selector_controller.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 shell->metrics()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW); | 75 shell->metrics()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW); |
| 76 shell->window_selector_controller()->ToggleOverview(); | 76 shell->window_selector_controller()->ToggleOverview(); |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool OverviewGestureHandler::ProcessGestureEvent( | 80 bool OverviewGestureHandler::ProcessGestureEvent( |
| 81 const ui::GestureEvent& event) { | 81 const ui::GestureEvent& event) { |
| 82 // Detect at the beginning of any gesture whether it begins on the top bezel. | 82 // Detect at the beginning of any gesture whether it begins on the top bezel. |
| 83 if (event.type() == ui::ET_GESTURE_BEGIN && | 83 if (event.type() == ui::ET_GESTURE_BEGIN && |
| 84 event.details().touch_points() == 1) { | 84 event.details().touch_points() == 1) { |
| 85 gfx::Point point_in_screen(event.location()); | 85 gfx::Point point_in_screen(gfx::ToFlooredPoint(event.location())); |
| 86 aura::Window* target = static_cast<aura::Window*>(event.target()); | 86 aura::Window* target = static_cast<aura::Window*>(event.target()); |
| 87 wm::ConvertPointToScreen(target, &point_in_screen); | 87 wm::ConvertPointToScreen(target, &point_in_screen); |
| 88 in_top_bezel_gesture_ = !Shell::GetScreen()->GetDisplayNearestPoint( | 88 in_top_bezel_gesture_ = !Shell::GetScreen()->GetDisplayNearestPoint( |
| 89 point_in_screen).bounds().y() + kTopBezelExtraPixels > | 89 point_in_screen).bounds().y() + kTopBezelExtraPixels > |
| 90 point_in_screen.y(); | 90 point_in_screen.y(); |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (!in_top_bezel_gesture_ || | 94 if (!in_top_bezel_gesture_ || |
| 95 event.type() != ui::ET_GESTURE_MULTIFINGER_SWIPE || | 95 event.type() != ui::ET_GESTURE_MULTIFINGER_SWIPE || |
| 96 !event.details().swipe_down() || | 96 !event.details().swipe_down() || |
| 97 event.details().touch_points() != 3) { | 97 event.details().touch_points() != 3) { |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 Shell* shell = Shell::GetInstance(); | 101 Shell* shell = Shell::GetInstance(); |
| 102 shell->metrics()->RecordUserMetricsAction(UMA_GESTURE_OVERVIEW); | 102 shell->metrics()->RecordUserMetricsAction(UMA_GESTURE_OVERVIEW); |
| 103 shell->window_selector_controller()->ToggleOverview(); | 103 shell->window_selector_controller()->ToggleOverview(); |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace ash | 107 } // namespace ash |
| OLD | NEW |