| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | |
| 6 #define ASH_COMMON_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/time/time.h" | |
| 11 #include "ui/gfx/geometry/point.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 | |
| 15 // TwoStepEdgeCycler is responsible for cycling between two modes when the mouse | |
| 16 // is at the edge of the workspace. The cycler does not loop so it is impossible | |
| 17 // to get back to the first mode once the second mode is reached. | |
| 18 // TwoStepEdgeCycler should be destroyed once the mouse moves off the edge of | |
| 19 // the workspace. | |
| 20 class ASH_EXPORT TwoStepEdgeCycler { | |
| 21 public: | |
| 22 // The direction in which a mouse should travel to switch mode. | |
| 23 enum Direction { DIRECTION_LEFT, DIRECTION_RIGHT }; | |
| 24 | |
| 25 explicit TwoStepEdgeCycler(const gfx::Point& start, Direction direction); | |
| 26 ~TwoStepEdgeCycler(); | |
| 27 | |
| 28 // Update which mode should be used as a result of a mouse / touch move. | |
| 29 // |location| is the location of the event. | |
| 30 void OnMove(const gfx::Point& location); | |
| 31 | |
| 32 bool use_second_mode() const { return second_mode_; } | |
| 33 | |
| 34 private: | |
| 35 // Whether the second mode should be used. | |
| 36 bool second_mode_; | |
| 37 | |
| 38 // Time OnMove() was last invoked. | |
| 39 base::TimeTicks time_last_move_; | |
| 40 | |
| 41 // The number of moves since the cycler was constructed. | |
| 42 int num_moves_; | |
| 43 | |
| 44 // Initial x-coordinate. | |
| 45 int start_x_; | |
| 46 | |
| 47 // x-coordinate when paused. | |
| 48 int paused_x_; | |
| 49 | |
| 50 // Whether the movement was paused. | |
| 51 bool paused_; | |
| 52 | |
| 53 // Determines a preferred movement direction that we are watching. | |
| 54 Direction direction_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler); | |
| 57 }; | |
| 58 | |
| 59 } // namespace ash | |
| 60 | |
| 61 #endif // ASH_COMMON_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | |
| OLD | NEW |