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

Unified Diff: ash/system/tray_drag_controller.h

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Swiping IME/Stylues/System tray/Notifications tray/bubble. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/tray_drag_controller.h
diff --git a/ash/system/tray_drag_controller.h b/ash/system/tray_drag_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a7313aca6732154efb2e88d88cb75c7ef049ebd
--- /dev/null
+++ b/ash/system/tray_drag_controller.h
@@ -0,0 +1,69 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_
+#define ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_
+
+#include "ash/ash_export.h"
+#include "ash/shelf/shelf.h"
+#include "ui/views/view.h"
+
+namespace ash {
+class TrayBackgroundView;
+
+class ASH_EXPORT TrayDragController {
+ public:
+ // The threshold of the velocity of the fling event.
+ static constexpr float kFlingVelocity = 100.0f;
+
+ 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.
+
+ // Process a gesture event and updates the dragging state of the bubble when
+ // appropriate. Returns true if the gesture has been handled and it should not
+ // be processed any further, false otherwise.
+ bool ProcessGestureEvent(const ui::GestureEvent& event,
+ TrayBackgroundView* target_view,
+ 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
+
+ private:
+ // Gesture related functions:
+ bool StartGestureDrag(const ui::GestureEvent& gesture);
+ void UpdateGestureDrag(const ui::GestureEvent& gesture);
+ void CompleteGestureDrag(const ui::GestureEvent& gesture);
+
+ // Update the bounds of the tray bubbles according to
+ // |gesture_drag_amount_|.
+ void UpdateBubbleBounds();
+
+ // Return true if the bubbles should be shown (i.e., animated upward to
+ // be made fully visible) after a sequence of scroll events terminated by
+ // |sequence_end|. Otherwise return false, indicating that the
+ // partially-visible bubble should be animated downward and made fully
+ // hidden.
+ bool ShouldShowBubbleAfterScrollSequence(
+ const ui::GestureEvent& sequence_end);
+
+ Shelf* shelf_;
+ TrayBackgroundView* target_view_ = nullptr;
+
+ // The original bounds of the tray bubble.
+ gfx::Rect tray_bubble_bounds_;
+
+ // Tracks the amount of the drag. Only valid if |is_in_drag_| is true.
+ float gesture_drag_amount_ = 0.f;
+
+ // 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.
+ // tray bubble, false otherwise.
+ bool is_in_drag_ = false;
+
+ // 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.
+ // tray view.
+ bool is_on_bubble_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(TrayDragController);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_DRAG_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698