| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SHELF_SHELF_H_ | |
| 6 #define ASH_SHELF_SHELF_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "ash/ash_export.h" | |
| 13 #include "ash/common/shelf/shelf_constants.h" | |
| 14 #include "ash/common/shelf/shelf_locking_manager.h" | |
| 15 #include "ash/common/shelf/shelf_types.h" | |
| 16 #include "ash/shelf/shelf_widget.h" | |
| 17 #include "base/macros.h" | |
| 18 #include "ui/gfx/geometry/size.h" | |
| 19 #include "ui/views/widget/widget_observer.h" | |
| 20 | |
| 21 namespace app_list { | |
| 22 class ApplicationDragAndDropHost; | |
| 23 } | |
| 24 | |
| 25 namespace gfx { | |
| 26 class Rect; | |
| 27 } | |
| 28 | |
| 29 namespace views { | |
| 30 class View; | |
| 31 } | |
| 32 | |
| 33 namespace ash { | |
| 34 class AppListButton; | |
| 35 class FocusCycler; | |
| 36 class ShelfDelegate; | |
| 37 class ShelfView; | |
| 38 class WmShelf; | |
| 39 | |
| 40 namespace test { | |
| 41 class ShelfTestAPI; | |
| 42 } | |
| 43 | |
| 44 // Controller for shelf state. | |
| 45 // DEPRECATED: WmShelf is replacing this class as part of the mus/mash refactor. | |
| 46 // Use WmShelf for access to state (visibility, auto-hide, etc.). | |
| 47 class ASH_EXPORT Shelf { | |
| 48 public: | |
| 49 Shelf(WmShelf* wm_shelf, ShelfView* shelf_view, ShelfWidget* widget); | |
| 50 ~Shelf(); | |
| 51 | |
| 52 // Return the shelf for the primary display. NULL if no user is logged in yet. | |
| 53 // Useful for tests. For production code use ForWindow() because the user may | |
| 54 // have multiple displays. | |
| 55 static Shelf* ForPrimaryDisplay(); | |
| 56 | |
| 57 // Return the shelf for the display that |window| is currently on, or a shelf | |
| 58 // on primary display if the shelf per display feature is disabled. NULL if no | |
| 59 // user is logged in yet. | |
| 60 static Shelf* ForWindow(const WmWindow* window); | |
| 61 | |
| 62 // DEPRECATED. Use WmShelf::GetAlignment() and SetAlignment(). | |
| 63 void SetAlignment(ShelfAlignment alignment); | |
| 64 ShelfAlignment alignment() const { return alignment_; } | |
| 65 | |
| 66 // Sets the ShelfAutoHideBehavior. See enum description for details. | |
| 67 // DEPRECATED. Use WmShelf::GetAutoHideBehavior() and SetAutoHideBehavior(). | |
| 68 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); | |
| 69 ShelfAutoHideBehavior auto_hide_behavior() const { | |
| 70 return auto_hide_behavior_; | |
| 71 } | |
| 72 | |
| 73 ShelfAutoHideState GetAutoHideState() const; | |
| 74 | |
| 75 ShelfVisibilityState GetVisibilityState() const; | |
| 76 | |
| 77 // Returns the screen bounds of the item for the specified window. If there is | |
| 78 // no item for the specified window an empty rect is returned. | |
| 79 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); | |
| 80 | |
| 81 // Updates the icon position given the current window bounds. This is used | |
| 82 // when dragging panels to reposition them with respect to the other panels. | |
| 83 void UpdateIconPositionForWindow(WmWindow* window); | |
| 84 | |
| 85 // Activates the the shelf item specified by the index in the list of shelf | |
| 86 // items. | |
| 87 void ActivateShelfItem(int index); | |
| 88 | |
| 89 // Cycles the window focus linearly over the current shelf items. | |
| 90 void CycleWindowLinear(CycleDirection direction); | |
| 91 | |
| 92 AppListButton* GetAppListButton() const; | |
| 93 | |
| 94 // Launch a 0-indexed shelf item in the shelf. | |
| 95 // A negative index launches the last shelf item in the shelf. | |
| 96 void LaunchAppIndexAt(int item_index); | |
| 97 | |
| 98 ShelfWidget* shelf_widget() { return shelf_widget_; } | |
| 99 | |
| 100 // TODO(msw): ShelfLayoutManager should not be accessed externally. | |
| 101 ShelfLayoutManager* shelf_layout_manager() { | |
| 102 return shelf_widget_->shelf_layout_manager(); | |
| 103 } | |
| 104 | |
| 105 // Returns rectangle bounding all visible shelf items. Used screen coordinate | |
| 106 // system. | |
| 107 gfx::Rect GetVisibleItemsBoundsInScreen() const; | |
| 108 | |
| 109 // Returns ApplicationDragAndDropHost for this shelf. | |
| 110 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | |
| 111 | |
| 112 // Updates the background for the shelf items. | |
| 113 void UpdateShelfItemBackground(int alpha); | |
| 114 | |
| 115 ShelfLockingManager* shelf_locking_manager_for_testing() { | |
| 116 return &shelf_locking_manager_; | |
| 117 } | |
| 118 | |
| 119 ShelfView* shelf_view_for_testing() { return shelf_view_; } | |
| 120 | |
| 121 private: | |
| 122 friend class test::ShelfTestAPI; | |
| 123 | |
| 124 // The shelf controller. Owned by the root window controller. | |
| 125 WmShelf* wm_shelf_; | |
| 126 ShelfWidget* shelf_widget_; | |
| 127 ShelfView* shelf_view_; | |
| 128 ShelfLockingManager shelf_locking_manager_; | |
| 129 | |
| 130 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; | |
| 131 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | |
| 132 | |
| 133 DISALLOW_COPY_AND_ASSIGN(Shelf); | |
| 134 }; | |
| 135 | |
| 136 } // namespace ash | |
| 137 | |
| 138 #endif // ASH_SHELF_SHELF_H_ | |
| OLD | NEW |