| 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 #ifndef ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ | 5 #ifndef ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ |
| 6 #define ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ | 6 #define ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 | 10 |
| 10 namespace ui { | 11 namespace ui { |
| 11 class ScrollEvent; | 12 class ScrollEvent; |
| 12 } | 13 } |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 | 16 |
| 16 // This handles 3-finger touchpad scroll events to enter/exit overview mode. | 17 // This handles 3-finger touchpad scroll events to enter/exit overview mode. |
| 17 class OverviewGestureHandler { | 18 class ASH_EXPORT OverviewGestureHandler { |
| 18 public: | 19 public: |
| 19 OverviewGestureHandler(); | 20 OverviewGestureHandler(); |
| 20 virtual ~OverviewGestureHandler(); | 21 virtual ~OverviewGestureHandler(); |
| 21 | 22 |
| 22 // Processes a scroll event and may start overview. Returns true if the event | 23 // Processes a scroll event and may start overview. Returns true if the event |
| 23 // has been handled and should not be processed further, false otherwise. | 24 // has been handled and should not be processed further, false otherwise. |
| 24 bool ProcessScrollEvent(const ui::ScrollEvent& event); | 25 bool ProcessScrollEvent(const ui::ScrollEvent& event); |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 // The total distance scrolled with three fingers. | 28 friend class OverviewGestureHandlerTest; |
| 29 |
| 30 // The total distance scrolled with three fingers up to the point when an |
| 31 // action is triggered. When the action (enter / exit overview mode or move |
| 32 // selection in overview) is triggered those values are reset to zero. |
| 28 float scroll_x_; | 33 float scroll_x_; |
| 29 float scroll_y_; | 34 float scroll_y_; |
| 30 | 35 |
| 36 // The threshold before engaging overview with a touchpad three-finger scroll. |
| 37 static const float vertical_threshold_pixels_; |
| 38 |
| 39 // The threshold before moving selector horizontally when using a touchpad |
| 40 // two or three-finger scroll. |
| 41 static const float horizontal_threshold_pixels_; |
| 42 |
| 31 DISALLOW_COPY_AND_ASSIGN(OverviewGestureHandler); | 43 DISALLOW_COPY_AND_ASSIGN(OverviewGestureHandler); |
| 32 }; | 44 }; |
| 33 | 45 |
| 34 } // namespace ash | 46 } // namespace ash |
| 35 | 47 |
| 36 #endif // ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ | 48 #endif // ASH_WM_GESTURES_OVERVIEW_GESTURE_HANDLER_H_ |
| OLD | NEW |