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

Unified Diff: ash/system/tray/system_tray.h

Issue 2930123002: Tablet WM : Swiping on system tray bubble. (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « no previous file | ash/system/tray/system_tray.cc » ('j') | ash/system/tray/system_tray.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2d821b4db00ad80c7b7521b65a4a7736ed19314f 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"
@@ -38,6 +39,10 @@ class TrayTiles;
class TrayUpdate;
class WebNotificationTray;
+namespace test {
+class SystemTrayTest;
+}
+
// There are different methods for creating bubble views.
enum BubbleCreationType {
BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one.
@@ -45,7 +50,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,14 +142,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();
+ gfx::Rect GetWorkAreaBoundsInScreen() const;
+
+ bool in_maximize_mode() { return in_maximize_mode_; }
+
private:
friend class SystemTrayTestApi;
+ friend class test::SystemTrayTest;
xiyuan 2017/06/16 17:33:42 Can you extend SystemTrayTestApi to allow setting
minch1 2017/06/16 22:11:51 Done.
class ActivationObserver;
// Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback.
@@ -193,6 +208,42 @@ 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);
+
+ // Update the bounds of the system tray bubble according to the location of
+ // the gesture.
+ void UpdateBoundsOnGesture(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.
xiyuan 2017/06/16 17:33:42 This comment seems to be just for ShouldShowSystem
minch1 2017/06/16 22:11:51 Done.
+ bool ShouldShowSystemBubbleBasedOnPosition();
xiyuan 2017/06/16 17:33:42 nit: ShouldShowSystemBubbleBasedOnPosition -> Shou
minch1 2017/06/16 22:11:51 Done.
+ bool ShouldShowSystemBubbleForSwiping(const ui::GestureEvent& gesture);
+
+ // Shelf the system tray is in.
+ Shelf* const shelf_;
+
+ // Swiping of the system tray bubble is only for maximize mode.
+ bool in_maximize_mode_ = false;
+
+ // The original bounds of the system tray bubble.
+ gfx::Rect system_tray_bubble_bounds_ = gfx::Rect();
+
+ // 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;
« no previous file with comments | « no previous file | ash/system/tray/system_tray.cc » ('j') | ash/system/tray/system_tray.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698