OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | 5 #ifndef ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ |
6 #define ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | 6 #define ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/workspace/workspace_window_resizer.h" | |
9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 | 15 |
15 // TwoStepEdgeCycler is responsible for cycling between two modes when the mouse | 16 // 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 // 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 // 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 // TwoStepEdgeCycler should be destroyed once the mouse moves off the edge of |
19 // the workspace. | 20 // the workspace. |
20 class ASH_EXPORT TwoStepEdgeCycler { | 21 class ASH_EXPORT TwoStepEdgeCycler { |
21 public: | 22 public: |
22 explicit TwoStepEdgeCycler(const gfx::Point& start); | 23 explicit TwoStepEdgeCycler(const gfx::Point& start, SnapType snap_type); |
23 ~TwoStepEdgeCycler(); | 24 ~TwoStepEdgeCycler(); |
24 | 25 |
25 // Update which mode should be used as a result of a mouse / touch move. | 26 // Update which mode should be used as a result of a mouse / touch move. |
26 // |location| is the location of the event. | 27 // |location| is the location of the event. |
27 void OnMove(const gfx::Point& location); | 28 void OnMove(const gfx::Point& location); |
28 | 29 |
29 bool use_second_mode() const { return second_mode_; } | 30 bool use_second_mode() const { return second_mode_; } |
30 | 31 |
31 private: | 32 private: |
32 // Whether the second mode should be used. | 33 // Whether the second mode should be used. |
33 bool second_mode_; | 34 bool second_mode_; |
34 | 35 |
35 // Time OnMove() was last invoked. | 36 // Time OnMove() was last invoked. |
36 base::TimeTicks time_last_move_; | 37 base::TimeTicks time_last_move_; |
37 | 38 |
38 // The number of moves since the cycler was constructed. | 39 // The number of moves since the cycler was constructed. |
39 int num_moves_; | 40 int num_moves_; |
40 | 41 |
41 // Initial x-coordinate. | 42 // Initial x-coordinate. |
42 int start_x_; | 43 int start_x_; |
43 | 44 |
45 // x-coordinate when paused. | |
46 int paused_x_; | |
47 | |
48 // Whether the movement was paused. | |
49 bool paused_; | |
50 | |
51 // Determines a movement direction that we are watching after a pause. | |
52 SnapType snap_type_; | |
pkotwicz
2015/05/07 17:10:28
Can we use a different enum? I find it kind of ugl
varkha
2015/05/07 20:27:28
Done.
| |
53 | |
44 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler); | 54 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler); |
45 }; | 55 }; |
46 | 56 |
47 } // namespace ash | 57 } // namespace ash |
48 | 58 |
49 #endif // ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ | 59 #endif // ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_ |
OLD | NEW |