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 { | |
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) : shelf_(shelf) {} | |
msw
2017/07/12 05:04:52
Move the definition to the .cc file.
minch1
2017/07/13 19:10:36
Done.
| |
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 | |
24 // be processed any further, false otherwise. | |
25 bool ProcessGestureEvent(const ui::GestureEvent& event, | |
26 TrayBackgroundView* target_view, | |
27 bool is_on_bubble); | |
msw
2017/07/12 05:04:52
Please try removing the |is_on_bubble| parameter a
minch1
2017/07/13 19:10:37
Thanks. Tried the latter, looks that the GetNative
| |
28 | |
29 private: | |
30 // Gesture related functions: | |
31 bool StartGestureDrag(const ui::GestureEvent& gesture); | |
32 void UpdateGestureDrag(const ui::GestureEvent& gesture); | |
33 void CompleteGestureDrag(const ui::GestureEvent& gesture); | |
34 | |
35 // Update the bounds of the tray bubbles according to | |
36 // |gesture_drag_amount_|. | |
37 void UpdateBubbleBounds(); | |
38 | |
39 // Return true if the bubbles should be shown (i.e., animated upward to | |
40 // be made fully visible) after a sequence of scroll events terminated by | |
41 // |sequence_end|. Otherwise return false, indicating that the | |
42 // partially-visible bubble should be animated downward and made fully | |
43 // hidden. | |
44 bool ShouldShowBubbleAfterScrollSequence( | |
45 const ui::GestureEvent& sequence_end); | |
46 | |
47 Shelf* shelf_; | |
48 TrayBackgroundView* target_view_ = nullptr; | |
49 | |
50 // The original bounds of the tray bubble. | |
51 gfx::Rect tray_bubble_bounds_; | |
52 | |
53 // Tracks the amount of the drag. Only valid if |is_in_drag_| is true. | |
54 float gesture_drag_amount_ = 0.f; | |
55 | |
56 // True if the user is in the process of gesture-dragging to open the system | |
msw
2017/07/12 05:04:52
nit: no 'system', right?
minch1
2017/07/13 19:10:36
Done.
| |
57 // tray bubble, false otherwise. | |
58 bool is_in_drag_ = false; | |
59 | |
60 // True if the dragging happened on the bubble view, false if happened on the | |
msw
2017/07/12 05:04:52
nit: "false if it happened"
minch1
2017/07/13 19:10:37
Done.
| |
61 // tray view. | |
62 bool is_on_bubble_ = false; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(TrayDragController); | |
65 }; | |
66 | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_ | |
OLD | NEW |