Chromium Code Reviews| Index: ash/system/tray/system_tray.h |
| diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h |
| index fa16c53f74067aaee8e1eacaccff91add8d1d17d..ca5ce8c597f9e06b40832943d1cdcc20d166b3bf 100644 |
| --- a/ash/system/tray/system_tray.h |
| +++ b/ash/system/tray/system_tray.h |
| @@ -10,6 +10,7 @@ |
| #include <vector> |
|
tdanderson
2017/06/19 16:19:38
I see you are using bug 725977 to track many diffe
minch1
2017/06/20 16:45:34
Thanks for your suggestion Terry. I will split thi
tdanderson
2017/06/20 22:42:20
Acknowledged.
|
| #include "ash/ash_export.h" |
| +#include "ash/shell_observer.h" |
| #include "ash/system/tray/system_tray_bubble.h" |
| #include "ash/system/tray/tray_background_view.h" |
| #include "base/macros.h" |
| @@ -45,7 +46,8 @@ enum BubbleCreationType { |
| }; |
| class ASH_EXPORT SystemTray : public TrayBackgroundView, |
|
tdanderson
2017/06/19 16:19:38
Note that I have left a comment here listing the o
minch1
2017/06/20 16:45:34
Yes, I think it will has some code reuse in the fo
tdanderson
2017/06/20 22:42:20
Acknowledged.
|
| - public views::TrayBubbleView::Delegate { |
| + public views::TrayBubbleView::Delegate, |
| + public ShellObserver { |
|
xdai1
2017/06/19 19:01:30
You don't need observe Shell to get the maximize m
minch1
2017/06/20 16:45:34
Done.
|
| public: |
| explicit SystemTray(Shelf* shelf); |
| ~SystemTray() override; |
| @@ -136,12 +138,23 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView, |
| base::string16 GetAccessibleNameForBubble() override; |
| void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| + // ShellObserver: |
| + void OnMaximizeModeStarted() override; |
| + void OnMaximizeModeEnded() override; |
| + |
| ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
| ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
| // Activates the system tray bubble. |
| void ActivateBubble(); |
| + // Overridden from ui::EventHandler: |
|
tdanderson
2017/06/19 16:19:38
nit: just "ui::EventHandler:"
minch1
2017/06/20 16:45:34
Done.
|
| + void OnGestureEvent(ui::GestureEvent* event) override; |
| + |
| + gfx::Rect GetWorkAreaBoundsInScreen() const; |
| + |
| + bool in_maximize_mode() { return in_maximize_mode_; } |
| + |
| private: |
| friend class SystemTrayTestApi; |
| class ActivationObserver; |
| @@ -193,6 +206,42 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView, |
| // Overridden from ActionableView. |
| bool PerformAction(const ui::Event& event) override; |
| + // Gesture related functions: |
| + bool ProcessGestureEvent(const ui::GestureEvent& event); |
| + bool StartGestureDrag(const ui::GestureEvent& gesture); |
| + void UpdateGestureDrag(const ui::GestureEvent& gesture); |
| + void CompleteGestureDrag(const ui::GestureEvent& gesture); |
| + |
| + // Returns true if swiping down triggered on the system tray area on the |
| + // shelf. |
| + bool IsDraggingDownOnShelf(const ui::GestureEvent& gesture); |
| + |
| + // Update the bounds of the system tray bubble according to the location of |
| + // the gesture drag. |
| + void UpdateBoundsOnDragging(const ui::GestureEvent& gesture); |
| + |
| + // Open the system tray bubble if the drag amount is larger than one third of |
| + // the height of the bubble. Otherwise, close it. |
| + bool ShouldShowSystemBubbleBasedOnDragAmount(); |
| + |
| + // Rules of opening / closing the system bubble for gesture dragging. |
| + // |ET_GESTURE_SCROLL_END| considers only the position of the dragging. |
| + // |ET_SCROLL_FLING_START| should consider both position and velocity of the |
| + // dragging. |
| + bool ShouldShowSystemBubbleForDragging(const ui::GestureEvent& gesture); |
| + |
| + // Shelf the system tray is in. |
| + Shelf* const shelf_; |
| + |
| + // Swiping of the system tray bubble is only for maximize mode. |
|
tdanderson
2017/06/19 16:19:38
Can you clarify why you want to restrict this func
minch1
2017/06/20 16:45:34
I think the touch gestures here is only for tablet
tdanderson
2017/06/20 22:42:20
OK as discussed in the other email thread, in a fo
minch1
2017/06/22 17:42:10
Done.
|
| + bool in_maximize_mode_ = false; |
| + |
| + // The original bounds of the system tray bubble. |
| + gfx::Rect system_tray_bubble_bounds_ = gfx::Rect(); |
|
xdai1
2017/06/19 19:01:30
nit: I don't think you need this initialization.
minch1
2017/06/20 16:45:34
Done.
|
| + |
| + // Tracks the amount of the drag. |
| + float gesture_drag_amount_ = 0.f; |
| + |
| // The web notification tray view that appears adjacent to this view. |
| WebNotificationTray* web_notification_tray_ = nullptr; |