OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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_SYSTEM_TRAY_DRAG_CONTROLLER_H_ | |
6 #define ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/shelf/shelf.h" | |
10 #include "ui/views/view.h" | |
11 | |
12 namespace ash { | |
13 class TrayBackgroundView; | |
14 | |
15 class ASH_EXPORT TrayDragController { | |
tdanderson
2017/07/17 22:44:37
Please add brief class-level documentation here.
minch1
2017/07/18 03:58:59
Done.
| |
16 public: | |
17 // The threshold of the velocity of the fling event. | |
18 static constexpr float kFlingVelocity = 100.0f; | |
19 | |
20 explicit TrayDragController(Shelf* shelf); | |
21 | |
22 // Process a gesture event and updates the dragging state of the bubble when | |
23 // appropriate. Returns true if the gesture has been handled and it should not | |
tdanderson
2017/07/17 22:44:37
It looks like you return true if and only if |even
minch1
2017/07/18 03:58:59
Done.
| |
24 // be processed any further, false otherwise. | |
25 bool ProcessGestureEvent(ui::GestureEvent* event, | |
26 TrayBackgroundView* tray_view); | |
27 | |
28 private: | |
29 // Gesture related functions: | |
30 bool StartGestureDrag(const ui::GestureEvent& gesture); | |
31 void UpdateGestureDrag(const ui::GestureEvent& gesture); | |
32 void CompleteGestureDrag(const ui::GestureEvent& gesture); | |
33 | |
34 // Update the bounds of the tray bubbles according to | |
tdanderson
2017/07/17 22:44:37
nit: 'bubble' instead of 'bubbles'. Similar for li
minch1
2017/07/18 03:58:59
Done.
| |
35 // |gesture_drag_amount_|. | |
36 void UpdateBubbleBounds(); | |
37 | |
38 // Return true if the bubbles should be shown (i.e., animated upward to | |
39 // be made fully visible) after a sequence of scroll events terminated by | |
40 // |sequence_end|. Otherwise return false, indicating that the | |
41 // partially-visible bubble should be animated downward and made fully | |
42 // hidden. | |
43 bool ShouldShowBubbleAfterScrollSequence( | |
44 const ui::GestureEvent& sequence_end); | |
45 | |
46 Shelf* shelf_; | |
47 TrayBackgroundView* tray_view_ = nullptr; | |
tdanderson
2017/07/17 22:44:37
nit: please add brief documentation for these two
minch1
2017/07/18 03:58:59
Done.
| |
48 | |
49 // The original bounds of the tray bubble. | |
50 gfx::Rect tray_bubble_bounds_; | |
51 | |
52 // Tracks the amount of the drag. Only valid if |is_in_drag_| is true. | |
53 float gesture_drag_amount_ = 0.f; | |
54 | |
55 // True if the user is in the process of gesture-dragging to open the tray | |
tdanderson
2017/07/17 22:44:37
Isn't this also true if the user is gesture-draggi
minch1
2017/07/18 03:58:59
Done.
| |
56 // bubble, false otherwise. | |
57 bool is_in_drag_ = false; | |
58 | |
59 // True if the dragging happened on the bubble view, false if it happened on | |
60 // the tray view. | |
61 bool is_on_bubble_ = false; | |
tdanderson
2017/07/17 22:44:37
Should you also say "Only valid if |is_in_drag_| i
minch1
2017/07/18 03:58:59
Done.
| |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(TrayDragController); | |
64 }; | |
65 | |
66 } // namespace ash | |
67 | |
68 #endif // ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_ | |
OLD | NEW |