Chromium Code Reviews| 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_SHELF_WM_SHELF_H_ | 5 #ifndef ASH_SHELF_WM_SHELF_H_ |
| 6 #define ASH_SHELF_WM_SHELF_H_ | 6 #define ASH_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 15 matching lines...) Expand all Loading... | |
| 26 class ShelfBezelEventHandler; | 26 class ShelfBezelEventHandler; |
| 27 class ShelfLayoutManager; | 27 class ShelfLayoutManager; |
| 28 class ShelfLayoutManagerTest; | 28 class ShelfLayoutManagerTest; |
| 29 class ShelfLockingManager; | 29 class ShelfLockingManager; |
| 30 class ShelfView; | 30 class ShelfView; |
| 31 class ShelfWidget; | 31 class ShelfWidget; |
| 32 class StatusAreaWidget; | 32 class StatusAreaWidget; |
| 33 class WmShelfObserver; | 33 class WmShelfObserver; |
| 34 class WmWindow; | 34 class WmWindow; |
| 35 | 35 |
| 36 // Controller for the shelf state. Exists for the lifetime of each root window | 36 // Controller for the shelf state. One per display, because each display might |
| 37 // controller. Note that the shelf widget may not be created until after login. | 37 // have different shelf alignment, autohide, etc. Exists for the lifetime of the |
|
James Cook
2017/05/16 21:32:35
This bit about the widget was a lie.
msw
2017/05/16 22:42:00
Acknowledged.
| |
| 38 // root window controller. | |
| 38 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { | 39 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { |
|
msw
2017/05/16 22:42:00
Should we rename this to Shelf at some point? :D
James Cook
2017/05/17 16:16:13
Yeah. Or ShelfController (and merge with the exist
| |
| 39 public: | 40 public: |
| 40 WmShelf(); | 41 WmShelf(); |
| 41 ~WmShelf() override; | 42 ~WmShelf() override; |
| 42 | 43 |
| 43 // Returns the shelf for the display that |window| is on. Note that the shelf | 44 // Returns the shelf for the display that |window| is on. Note that the shelf |
| 44 // widget may not exist, or the shelf may not be visible. | 45 // widget may not exist, or the shelf may not be visible. |
| 45 static WmShelf* ForWindow(WmWindow* window); | 46 static WmShelf* ForWindow(WmWindow* window); |
| 46 | 47 |
| 47 // Returns if shelf alignment options are enabled, and the user is able to | 48 // Returns if shelf alignment options are enabled, and the user is able to |
| 48 // adjust the alignment (eg. not allowed in guest and supervised user modes). | 49 // adjust the alignment (eg. not allowed in guest and supervised user modes). |
| 49 static bool CanChangeShelfAlignment(); | 50 static bool CanChangeShelfAlignment(); |
| 50 | 51 |
| 51 void CreateShelfWidget(WmWindow* root); | 52 void CreateShelfWidget(WmWindow* root); |
| 52 void ShutdownShelfWidget(); | 53 void ShutdownShelfWidget(); |
| 53 void DestroyShelfWidget(); | 54 void DestroyShelfWidget(); |
| 54 | 55 |
| 55 ShelfLayoutManager* shelf_layout_manager() const { | 56 ShelfLayoutManager* shelf_layout_manager() const { |
| 56 return shelf_layout_manager_; | 57 return shelf_layout_manager_; |
| 57 } | 58 } |
| 58 | 59 |
| 59 ShelfWidget* shelf_widget() { return shelf_widget_.get(); } | 60 ShelfWidget* shelf_widget() { return shelf_widget_.get(); } |
| 60 | 61 |
| 61 // Creates the shelf view. | |
| 62 void CreateShelfView(); | |
| 63 | |
| 64 // TODO(jamescook): Eliminate this method. | 62 // TODO(jamescook): Eliminate this method. |
| 65 void ShutdownShelf(); | 63 void NotifyShelfInitialized(); |
| 66 | |
| 67 // True after the ShelfView has been created (e.g. after login). | |
| 68 bool IsShelfInitialized() const; | |
| 69 | 64 |
| 70 // Returns the window showing the shelf. | 65 // Returns the window showing the shelf. |
| 71 WmWindow* GetWindow(); | 66 WmWindow* GetWindow(); |
| 72 | 67 |
| 73 ShelfAlignment alignment() const { return alignment_; } | 68 ShelfAlignment alignment() const { return alignment_; } |
| 74 // TODO(jamescook): Replace with alignment(). | 69 // TODO(jamescook): Replace with alignment(). |
| 75 ShelfAlignment GetAlignment() const { return alignment_; } | 70 ShelfAlignment GetAlignment() const { return alignment_; } |
| 76 void SetAlignment(ShelfAlignment alignment); | 71 void SetAlignment(ShelfAlignment alignment); |
| 77 | 72 |
| 78 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). | 73 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 private: | 147 private: |
| 153 class AutoHideEventHandler; | 148 class AutoHideEventHandler; |
| 154 friend class ShelfLayoutManagerTest; | 149 friend class ShelfLayoutManagerTest; |
| 155 | 150 |
| 156 // Layout manager for the shelf container window. Instances are constructed by | 151 // Layout manager for the shelf container window. Instances are constructed by |
| 157 // ShelfWidget and lifetimes are managed by the container windows themselves. | 152 // ShelfWidget and lifetimes are managed by the container windows themselves. |
| 158 ShelfLayoutManager* shelf_layout_manager_ = nullptr; | 153 ShelfLayoutManager* shelf_layout_manager_ = nullptr; |
| 159 | 154 |
| 160 std::unique_ptr<ShelfWidget> shelf_widget_; | 155 std::unique_ptr<ShelfWidget> shelf_widget_; |
| 161 | 156 |
| 162 // Internal implementation detail. Do not expose externally. Owned by views | |
| 163 // hierarchy. Null before login and in secondary display init. | |
| 164 ShelfView* shelf_view_ = nullptr; | |
| 165 | |
| 166 // These initial values hide the shelf until user preferences are available. | 157 // These initial values hide the shelf until user preferences are available. |
| 167 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; | 158 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; |
| 168 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_ALWAYS_HIDDEN; | 159 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_ALWAYS_HIDDEN; |
| 169 | 160 |
| 170 // Sets shelf alignment to bottom during login and screen lock. | 161 // Sets shelf alignment to bottom during login and screen lock. |
| 171 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; | 162 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; |
| 172 | 163 |
| 173 base::ObserverList<WmShelfObserver> observers_; | 164 base::ObserverList<WmShelfObserver> observers_; |
| 174 | 165 |
| 175 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide. | 166 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide. |
| 176 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/631216 | 167 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/631216 |
| 177 std::unique_ptr<AutoHideEventHandler> auto_hide_event_handler_; | 168 std::unique_ptr<AutoHideEventHandler> auto_hide_event_handler_; |
| 178 | 169 |
| 179 // Forwards touch gestures on a bezel sensor to the shelf. | 170 // Forwards touch gestures on a bezel sensor to the shelf. |
| 180 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647 | 171 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647 |
| 181 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_; | 172 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_; |
| 182 | 173 |
| 183 DISALLOW_COPY_AND_ASSIGN(WmShelf); | 174 DISALLOW_COPY_AND_ASSIGN(WmShelf); |
| 184 }; | 175 }; |
| 185 | 176 |
| 186 } // namespace ash | 177 } // namespace ash |
| 187 | 178 |
| 188 #endif // ASH_SHELF_WM_SHELF_H_ | 179 #endif // ASH_SHELF_WM_SHELF_H_ |
| OLD | NEW |