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..1fc641c8fac1b69a4753ddac4fdf291d081eb399 100644 |
| --- a/ash/system/tray/system_tray.h |
| +++ b/ash/system/tray/system_tray.h |
| @@ -10,6 +10,7 @@ |
| #include <vector> |
| #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, |
| - public views::TrayBubbleView::Delegate { |
| + public views::TrayBubbleView::Delegate, |
| + public ShellObserver { |
| public: |
| explicit SystemTray(Shelf* shelf); |
| ~SystemTray() override; |
| @@ -136,12 +138,20 @@ 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(); |
| + gfx::Rect GetWorkAreaBoundsInScreen() const; |
| + |
| + bool on_maximize_mode() { return on_maximize_mode_; } |
| + |
| private: |
| friend class SystemTrayTestApi; |
| class ActivationObserver; |
| @@ -193,6 +203,39 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView, |
| // Overridden from ActionableView. |
| bool PerformAction(const ui::Event& event) override; |
| + // Overridden from ui::EventHandler: |
| + void OnGestureEvent(ui::GestureEvent* 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 IsSwipingDownOnShelf(const ui::GestureEvent& gesture); |
| + |
| + // Rules for showing / closing the system bubble for swiping. |
| + // |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 ShouldShowSystemBubbleBasedOnPosition(); |
| + bool ShouldShowSystemBubbleForSwiping(const ui::GestureEvent& gesture); |
| + |
| + Shelf* shelf_; |
|
xiyuan
2017/06/12 18:00:51
nit: Shelf* -> Shelf* const since |shelf_| should
minch1
2017/06/16 03:30:35
Done.
|
| + // Swiping of the system tray bubble is only for maximize mode. |
| + bool on_maximize_mode_ = false; |
| + |
| + // The original bounds of the system tray bubble. |
| + gfx::Rect system_tray_bubble_bounds_; |
| + |
| + // Tracks the amount of the drag. |
| + float gesture_drag_amount_; |
|
xiyuan
2017/06/12 18:00:51
nit: initialize it to some value.
minch1
2017/06/16 03:30:34
Done.
|
| + |
| + // Tracks the final scroll delta of the gesture event. |
| + float final_scroll_y_; |
|
xiyuan
2017/06/12 18:00:51
nit: initialize it
minch1
2017/06/16 03:30:35
Done.
|
| + |
| // The web notification tray view that appears adjacent to this view. |
| WebNotificationTray* web_notification_tray_ = nullptr; |