Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: athena/wm/bezel_controller.h

Issue 420603011: Split Screen mode implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_view
Patch Set: Addressing mukai's review feedback. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 public: 27 public:
28 enum Bezel { BEZEL_NONE, BEZEL_LEFT, BEZEL_RIGHT, BEZEL_TOP, BEZEL_BOTTOM }; 28 enum Bezel { BEZEL_NONE, BEZEL_LEFT, BEZEL_RIGHT, BEZEL_TOP, BEZEL_BOTTOM };
29 29
30 // Responsible for handling scroll gestures initiated from the bezel. 30 // Responsible for handling scroll gestures initiated from the bezel.
31 // Two touch points are need to perform the bezel scroll gesture from 31 // Two touch points are need to perform the bezel scroll gesture from
32 // the left and right bezel. 32 // the left and right bezel.
33 class ScrollDelegate { 33 class ScrollDelegate {
34 public: 34 public:
35 virtual ~ScrollDelegate() {} 35 virtual ~ScrollDelegate() {}
36 36
37 // Beginning of a bezel scroll gesture started from the |bezel|. 37 // Beginning of a bezel scroll gesture started from the |bezel|.
oshima 2014/08/06 21:54:08 can you document |delta| as well?
mfomitchev 2014/08/08 16:03:22 Done.
38 virtual void ScrollBegin(Bezel bezel, float delta) = 0; 38 virtual void ScrollBegin(Bezel bezel, float delta) = 0;
39 39
40 // End of the current bezel scroll 40 // End of the current bezel scroll
41 virtual void ScrollEnd() = 0; 41 virtual void ScrollEnd() = 0;
42 42
43 // Update of the scroll position for the currently active bezel scroll. 43 // Update of the scroll position for the currently active bezel scroll.
44 virtual void ScrollUpdate(float delta) = 0; 44 virtual void ScrollUpdate(float delta) = 0;
45 45
46 // Should return false if the delegate isn't going to react to the scroll 46 // Should return false if the delegate isn't going to react to the scroll
47 // events. 47 // events.
(...skipping 12 matching lines...) Expand all
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 void SetState(State state);
71 float GetDistance(const gfx::PointF& position, Bezel bezel); 71 // |scroll_delta| only needs to be passed when |state| is one of the
72 72 // BEZEL_SROLLING states.
73 // |scroll_position| only needs to be passed in the scrolling state 73 void SetState(State state, float scroll_delta);
74 void SetState(State state, const gfx::PointF& scroll_position);
75 74
76 // Returns the bezel corresponding to the |location| or BEZEL_NONE if the 75 // Returns the bezel corresponding to the |location| or BEZEL_NONE if the
77 // location is outside of the bezel area. 76 // location is outside of the bezel area.
78 Bezel GetBezel(const gfx::PointF& location); 77 Bezel GetBezel(const gfx::PointF& location);
79 78
80 // ui::EventHandler overrides 79 // ui::EventHandler overrides
81 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 80 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
82 81
83 aura::Window* container_; 82 aura::Window* container_;
84 83
85 State state_; 84 State state_;
86 85
87 // The bezel where the currently active scroll was started. 86 // The bezel where the currently active scroll was started.
88 Bezel scroll_bezel_; 87 Bezel scroll_bezel_;
89 88
90 // The target of the bezel scroll gesture. Used to filter out other gestures 89 // The target of the bezel scroll gesture. Used to filter out other gestures
91 // when the bezel scroll is in progress. 90 // when the bezel scroll is in progress.
92 ui::EventTarget* scroll_target_; 91 ui::EventTarget* scroll_target_;
93 92
94 // Responsible for handling gestures started from the left and right bezels. 93 // Responsible for handling gestures started from the left and right bezels.
95 // Not owned. 94 // Not owned.
96 ScrollDelegate* left_right_delegate_; 95 ScrollDelegate* left_right_delegate_;
97 96
98 DISALLOW_COPY_AND_ASSIGN(BezelController); 97 DISALLOW_COPY_AND_ASSIGN(BezelController);
99 }; 98 };
100 99
101 } // namespace athena 100 } // namespace athena
102 101
103 #endif // ATHENA_WM_BEZEL_CONTROLLER_H_ 102 #endif // ATHENA_WM_BEZEL_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698