OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_COMMON_SHELF_WM_SHELF_H_ | 5 #ifndef ASH_COMMON_SHELF_WM_SHELF_H_ |
6 #define ASH_COMMON_SHELF_WM_SHELF_H_ | 6 #define ASH_COMMON_SHELF_WM_SHELF_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class ShelfWidget; | 29 class ShelfWidget; |
30 class StatusAreaWidget; | 30 class StatusAreaWidget; |
31 class WmDimmerView; | 31 class WmDimmerView; |
32 class WmShelfObserver; | 32 class WmShelfObserver; |
33 class WmWindow; | 33 class WmWindow; |
34 | 34 |
35 // Controller for the shelf state. Exists for the lifetime of each root window | 35 // Controller for the shelf state. Exists for the lifetime of each root window |
36 // controller. Note that the shelf widget may not be created until after login. | 36 // controller. Note that the shelf widget may not be created until after login. |
37 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { | 37 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { |
38 public: | 38 public: |
| 39 // Returns the shelf for the display that |window| is on. Note that the shelf |
| 40 // widget may not exist, or the shelf may not be visible. |
| 41 static WmShelf* ForWindow(WmWindow* window); |
| 42 |
39 void SetShelf(Shelf* shelf); | 43 void SetShelf(Shelf* shelf); |
40 void ClearShelf(); | 44 void ClearShelf(); |
41 Shelf* shelf() const { return shelf_; } | 45 Shelf* shelf() const { return shelf_; } |
42 | 46 |
43 virtual void SetShelfLayoutManager(ShelfLayoutManager* manager); | 47 virtual void SetShelfLayoutManager(ShelfLayoutManager* manager); |
44 ShelfLayoutManager* shelf_layout_manager() const { | 48 ShelfLayoutManager* shelf_layout_manager() const { |
45 return shelf_layout_manager_; | 49 return shelf_layout_manager_; |
46 } | 50 } |
47 | 51 |
48 // Returns the window showing the shelf. | 52 // Returns the window showing the shelf. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 96 |
93 void UpdateVisibilityState(); | 97 void UpdateVisibilityState(); |
94 | 98 |
95 ShelfVisibilityState GetVisibilityState() const; | 99 ShelfVisibilityState GetVisibilityState() const; |
96 | 100 |
97 // Returns the ideal bounds of the shelf assuming it is visible. | 101 // Returns the ideal bounds of the shelf assuming it is visible. |
98 gfx::Rect GetIdealBounds(); | 102 gfx::Rect GetIdealBounds(); |
99 | 103 |
100 gfx::Rect GetUserWorkAreaBounds() const; | 104 gfx::Rect GetUserWorkAreaBounds() const; |
101 | 105 |
102 void UpdateIconPositionForWindow(WmWindow* window); | 106 // Updates the icon position given the current window bounds. This is used |
| 107 // when dragging panels to reposition them with respect to the other panels. |
| 108 void UpdateIconPositionForPanel(WmWindow* window); |
103 | 109 |
104 // Returns the screen bounds of the item for the specified window. If there is | 110 // Returns the screen bounds of the item for the specified window. If there is |
105 // no item for the specified window an empty rect is returned. | 111 // no item for the specified window an empty rect is returned. |
106 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); | 112 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); |
107 | 113 |
| 114 // Launch a 0-indexed shelf item in the shelf. A negative index launches the |
| 115 // last shelf item in the shelf. |
| 116 static void LaunchShelfItem(int item_index); |
| 117 |
| 118 // Activates the shelf item specified by the index in the list of shelf items. |
| 119 static void ActivateShelfItem(int item_index); |
| 120 |
108 // Handles a gesture |event| coming from a source outside the shelf widget | 121 // Handles a gesture |event| coming from a source outside the shelf widget |
109 // (e.g. the status area widget). Allows support for behaviors like toggling | 122 // (e.g. the status area widget). Allows support for behaviors like toggling |
110 // auto-hide with a swipe, even if that gesture event hits another window. | 123 // auto-hide with a swipe, even if that gesture event hits another window. |
111 // Returns true if the event was handled. | 124 // Returns true if the event was handled. |
112 bool ProcessGestureEvent(const ui::GestureEvent& event); | 125 bool ProcessGestureEvent(const ui::GestureEvent& event); |
113 | 126 |
114 void AddObserver(WmShelfObserver* observer); | 127 void AddObserver(WmShelfObserver* observer); |
115 void RemoveObserver(WmShelfObserver* observer); | 128 void RemoveObserver(WmShelfObserver* observer); |
116 | 129 |
117 void NotifyShelfIconPositionsChanged(); | 130 void NotifyShelfIconPositionsChanged(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 163 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
151 | 164 |
152 base::ObserverList<WmShelfObserver> observers_; | 165 base::ObserverList<WmShelfObserver> observers_; |
153 | 166 |
154 DISALLOW_COPY_AND_ASSIGN(WmShelf); | 167 DISALLOW_COPY_AND_ASSIGN(WmShelf); |
155 }; | 168 }; |
156 | 169 |
157 } // namespace ash | 170 } // namespace ash |
158 | 171 |
159 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ | 172 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ |
OLD | NEW |