| 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_SHELF_H_ | 5 #ifndef ASH_SHELF_SHELF_H_ |
| 6 #define ASH_SHELF_SHELF_H_ | 6 #define ASH_SHELF_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 | 29 |
| 30 enum class AnimationChangeType; | 30 enum class AnimationChangeType; |
| 31 class ShelfBezelEventHandler; | 31 class ShelfBezelEventHandler; |
| 32 class ShelfLayoutManager; | 32 class ShelfLayoutManager; |
| 33 class ShelfLayoutManagerTest; | 33 class ShelfLayoutManagerTest; |
| 34 class ShelfLockingManager; | 34 class ShelfLockingManager; |
| 35 class ShelfView; | 35 class ShelfView; |
| 36 class ShelfWidget; | 36 class ShelfWidget; |
| 37 class StatusAreaWidget; | 37 class StatusAreaWidget; |
| 38 class ShelfObserver; | 38 class ShelfObserver; |
| 39 class WmWindow; | |
| 40 | 39 |
| 41 // Controller for the shelf state. One per display, because each display might | 40 // Controller for the shelf state. One per display, because each display might |
| 42 // have different shelf alignment, autohide, etc. Exists for the lifetime of the | 41 // have different shelf alignment, autohide, etc. Exists for the lifetime of the |
| 43 // root window controller. | 42 // root window controller. |
| 44 class ASH_EXPORT Shelf : public ShelfLayoutManagerObserver { | 43 class ASH_EXPORT Shelf : public ShelfLayoutManagerObserver { |
| 45 public: | 44 public: |
| 46 Shelf(); | 45 Shelf(); |
| 47 ~Shelf() override; | 46 ~Shelf() override; |
| 48 | 47 |
| 49 // Returns the shelf for the display that |window| is on. Note that the shelf | 48 // Returns the shelf for the display that |window| is on. Note that the shelf |
| 50 // widget may not exist, or the shelf may not be visible. | 49 // widget may not exist, or the shelf may not be visible. |
| 51 static Shelf* ForWindow(aura::Window* window); | 50 static Shelf* ForWindow(aura::Window* window); |
| 52 | 51 |
| 53 // Returns if shelf alignment options are enabled, and the user is able to | 52 // Returns if shelf alignment options are enabled, and the user is able to |
| 54 // adjust the alignment (eg. not allowed in guest and supervised user modes). | 53 // adjust the alignment (eg. not allowed in guest and supervised user modes). |
| 55 static bool CanChangeShelfAlignment(); | 54 static bool CanChangeShelfAlignment(); |
| 56 | 55 |
| 57 void CreateShelfWidget(WmWindow* root); | 56 void CreateShelfWidget(aura::Window* root); |
| 58 void ShutdownShelfWidget(); | 57 void ShutdownShelfWidget(); |
| 59 void DestroyShelfWidget(); | 58 void DestroyShelfWidget(); |
| 60 | 59 |
| 61 ShelfLayoutManager* shelf_layout_manager() const { | 60 ShelfLayoutManager* shelf_layout_manager() const { |
| 62 return shelf_layout_manager_; | 61 return shelf_layout_manager_; |
| 63 } | 62 } |
| 64 | 63 |
| 65 ShelfWidget* shelf_widget() { return shelf_widget_.get(); } | 64 ShelfWidget* shelf_widget() { return shelf_widget_.get(); } |
| 66 | 65 |
| 67 // TODO(jamescook): Eliminate this method. | 66 // TODO(jamescook): Eliminate this method. |
| 68 void NotifyShelfInitialized(); | 67 void NotifyShelfInitialized(); |
| 69 | 68 |
| 70 // Returns the window showing the shelf. | 69 // Returns the window showing the shelf. |
| 71 WmWindow* GetWindow(); | 70 aura::Window* GetWindow(); |
| 72 | 71 |
| 73 ShelfAlignment alignment() const { return alignment_; } | 72 ShelfAlignment alignment() const { return alignment_; } |
| 74 void SetAlignment(ShelfAlignment alignment); | 73 void SetAlignment(ShelfAlignment alignment); |
| 75 | 74 |
| 76 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). | 75 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). |
| 77 bool IsHorizontalAlignment() const; | 76 bool IsHorizontalAlignment() const; |
| 78 | 77 |
| 79 // Returns a value based on shelf alignment. | 78 // Returns a value based on shelf alignment. |
| 80 int SelectValueForShelfAlignment(int bottom, int left, int right) const; | 79 int SelectValueForShelfAlignment(int bottom, int left, int right) const; |
| 81 | 80 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 99 | 98 |
| 100 ShelfVisibilityState GetVisibilityState() const; | 99 ShelfVisibilityState GetVisibilityState() const; |
| 101 | 100 |
| 102 // Returns the ideal bounds of the shelf assuming it is visible. | 101 // Returns the ideal bounds of the shelf assuming it is visible. |
| 103 gfx::Rect GetIdealBounds(); | 102 gfx::Rect GetIdealBounds(); |
| 104 | 103 |
| 105 gfx::Rect GetUserWorkAreaBounds() const; | 104 gfx::Rect GetUserWorkAreaBounds() const; |
| 106 | 105 |
| 107 // Updates the icon position given the current window bounds. This is used | 106 // Updates the icon position given the current window bounds. This is used |
| 108 // when dragging panels to reposition them with respect to the other panels. | 107 // when dragging panels to reposition them with respect to the other panels. |
| 109 void UpdateIconPositionForPanel(WmWindow* window); | 108 void UpdateIconPositionForPanel(aura::Window* window); |
| 110 | 109 |
| 111 // 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 |
| 112 // no item for the specified window an empty rect is returned. | 111 // no item for the specified window an empty rect is returned. |
| 113 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); | 112 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window); |
| 114 | 113 |
| 115 // Launch a 0-indexed shelf item in the shelf. A negative index launches the | 114 // Launch a 0-indexed shelf item in the shelf. A negative index launches the |
| 116 // last shelf item in the shelf. | 115 // last shelf item in the shelf. |
| 117 static void LaunchShelfItem(int item_index); | 116 static void LaunchShelfItem(int item_index); |
| 118 | 117 |
| 119 // Activates the shelf item specified by the index in the list of shelf items. | 118 // Activates the shelf item specified by the index in the list of shelf items. |
| 120 static void ActivateShelfItem(int item_index); | 119 static void ActivateShelfItem(int item_index); |
| 121 | 120 |
| 122 // 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 |
| 123 // (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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Forwards touch gestures on a bezel sensor to the shelf. | 168 // Forwards touch gestures on a bezel sensor to the shelf. |
| 170 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647 | 169 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647 |
| 171 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_; | 170 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_; |
| 172 | 171 |
| 173 DISALLOW_COPY_AND_ASSIGN(Shelf); | 172 DISALLOW_COPY_AND_ASSIGN(Shelf); |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 } // namespace ash | 175 } // namespace ash |
| 177 | 176 |
| 178 #endif // ASH_SHELF_SHELF_H_ | 177 #endif // ASH_SHELF_SHELF_H_ |
| OLD | NEW |