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 ATHENA_WM_BEZEL_CONTROLLER_H_ | 5 #ifndef ATHENA_WM_BEZEL_CONTROLLER_H_ |
6 #define ATHENA_WM_BEZEL_CONTROLLER_H_ | 6 #define ATHENA_WM_BEZEL_CONTROLLER_H_ |
7 | 7 |
8 #include "ui/events/event_handler.h" | 8 #include "ui/events/event_handler.h" |
9 | 9 |
10 namespace aura { | 10 namespace aura { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 private: | 61 private: |
62 enum State { | 62 enum State { |
63 NONE, | 63 NONE, |
64 IGNORE_CURRENT_SCROLL, | 64 IGNORE_CURRENT_SCROLL, |
65 BEZEL_GESTURE_STARTED, | 65 BEZEL_GESTURE_STARTED, |
66 BEZEL_SCROLLING_ONE_FINGER, | 66 BEZEL_SCROLLING_ONE_FINGER, |
67 BEZEL_SCROLLING_TWO_FINGERS, | 67 BEZEL_SCROLLING_TWO_FINGERS, |
68 }; | 68 }; |
69 | 69 |
70 // Calculates the distance from |position| to the |bezel|. | 70 // Calculates the distance from |location| specified in |window|'s coordinates |
71 float GetDistance(const gfx::PointF& position, Bezel bezel); | 71 // to the |bezel|. |
| 72 float GetDistance(const gfx::PointF& location, |
| 73 aura::Window* window, |
| 74 Bezel bezel); |
72 | 75 |
73 // |scroll_position| only needs to be passed in the scrolling state | 76 // |scroll_delta| only needs to be passed in the scrolling state |
74 void SetState(State state, const gfx::PointF& scroll_position); | 77 void SetState(State state, float scroll_delta); |
75 | 78 |
76 // Returns the bezel corresponding to the |location| or BEZEL_NONE if the | 79 // Returns the bezel corresponding to the |location| or BEZEL_NONE if the |
77 // location is outside of the bezel area. | 80 // location is outside of the bezel area. |
78 Bezel GetBezel(const gfx::PointF& location); | 81 Bezel GetBezel(const gfx::PointF& location); |
79 | 82 |
80 // ui::EventHandler overrides | 83 // ui::EventHandler overrides |
81 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 84 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
82 | 85 |
83 aura::Window* container_; | 86 aura::Window* container_; |
84 | 87 |
85 State state_; | 88 State state_; |
86 | 89 |
87 // The bezel where the currently active scroll was started. | 90 // The bezel where the currently active scroll was started. |
88 Bezel scroll_bezel_; | 91 Bezel scroll_bezel_; |
89 | 92 |
90 // The target of the bezel scroll gesture. Used to filter out other gestures | 93 // The target of the bezel scroll gesture. Used to filter out other gestures |
91 // when the bezel scroll is in progress. | 94 // when the bezel scroll is in progress. |
92 ui::EventTarget* scroll_target_; | 95 ui::EventTarget* scroll_target_; |
93 | 96 |
94 // Responsible for handling gestures started from the left and right bezels. | 97 // Responsible for handling gestures started from the left and right bezels. |
95 // Not owned. | 98 // Not owned. |
96 ScrollDelegate* left_right_delegate_; | 99 ScrollDelegate* left_right_delegate_; |
97 | 100 |
98 DISALLOW_COPY_AND_ASSIGN(BezelController); | 101 DISALLOW_COPY_AND_ASSIGN(BezelController); |
99 }; | 102 }; |
100 | 103 |
101 } // namespace athena | 104 } // namespace athena |
102 | 105 |
103 #endif // ATHENA_WM_BEZEL_CONTROLLER_H_ | 106 #endif // ATHENA_WM_BEZEL_CONTROLLER_H_ |
OLD | NEW |