OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SHELF_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_H_ |
6 #define ASH_COMMON_SHELF_SHELF_H_ | 6 #define ASH_COMMON_SHELF_SHELF_H_ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
13 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
14 #include "ash/common/shelf/shelf_locking_manager.h" | |
15 #include "ash/common/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
16 #include "ash/common/shelf/shelf_widget.h" | 11 #include "ash/common/shelf/shelf_widget.h" |
17 #include "base/macros.h" | 12 #include "base/macros.h" |
18 #include "ui/gfx/geometry/size.h" | |
19 #include "ui/views/widget/widget_observer.h" | |
20 | 13 |
21 namespace app_list { | 14 namespace app_list { |
22 class ApplicationDragAndDropHost; | 15 class ApplicationDragAndDropHost; |
23 } | 16 } |
24 | 17 |
25 namespace gfx { | 18 namespace gfx { |
26 class Rect; | 19 class Rect; |
27 } | 20 } |
28 | 21 |
29 namespace views { | |
30 class View; | |
31 } | |
32 | |
33 namespace ash { | 22 namespace ash { |
34 class AppListButton; | 23 class AppListButton; |
35 class FocusCycler; | |
36 class ShelfDelegate; | |
37 class ShelfView; | 24 class ShelfView; |
38 class WmShelf; | 25 class WmShelf; |
39 | 26 |
40 namespace test { | 27 namespace test { |
41 class ShelfTestAPI; | 28 class ShelfTestAPI; |
42 } | 29 } |
43 | 30 |
44 // Controller for shelf state. | 31 // Controller for shelf state. |
45 // DEPRECATED: WmShelf is replacing this class as part of the mus/mash refactor. | 32 // DEPRECATED: WmShelf is replacing this class as part of the mus/mash refactor. |
46 // Use WmShelf for access to state (visibility, auto-hide, etc.). | 33 // Use WmShelf for access to state (visibility, auto-hide, etc.). |
47 class ASH_EXPORT Shelf { | 34 class ASH_EXPORT Shelf { |
48 public: | 35 public: |
49 Shelf(WmShelf* wm_shelf, ShelfView* shelf_view, ShelfWidget* widget); | 36 Shelf(WmShelf* wm_shelf, ShelfView* shelf_view, ShelfWidget* widget); |
50 ~Shelf(); | 37 ~Shelf(); |
51 | 38 |
52 // Return the shelf for the primary display. NULL if no user is logged in yet. | 39 // 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 | 40 // Useful for tests. For production code use ForWindow() because the user may |
54 // have multiple displays. | 41 // have multiple displays. |
55 static Shelf* ForPrimaryDisplay(); | 42 static Shelf* ForPrimaryDisplay(); |
56 | 43 |
57 // Return the shelf for the display that |window| is currently on, or a shelf | 44 // 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 | 45 // on primary display if the shelf per display feature is disabled. NULL if no |
59 // user is logged in yet. | 46 // user is logged in yet. |
60 static Shelf* ForWindow(WmWindow* window); | 47 static Shelf* ForWindow(WmWindow* window); |
61 | 48 |
62 // DEPRECATED. Use WmShelf::GetAlignment() and SetAlignment(). | 49 // For porting from Shelf to WmShelf. |
63 void SetAlignment(ShelfAlignment alignment); | 50 // TODO(jamescook): Remove this. |
64 ShelfAlignment alignment() const { return alignment_; } | 51 WmShelf* wm_shelf() { return wm_shelf_; } |
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 | 52 |
77 // Returns the screen bounds of the item for the specified window. If there is | 53 // 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. | 54 // no item for the specified window an empty rect is returned. |
79 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); | 55 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); |
80 | 56 |
81 // Updates the icon position given the current window bounds. This is used | 57 // 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. | 58 // when dragging panels to reposition them with respect to the other panels. |
83 void UpdateIconPositionForWindow(WmWindow* window); | 59 void UpdateIconPositionForWindow(WmWindow* window); |
84 | 60 |
85 // Activates the the shelf item specified by the index in the list of shelf | 61 // Activates the the shelf item specified by the index in the list of shelf |
(...skipping 19 matching lines...) Expand all Loading... |
105 // Returns rectangle bounding all visible shelf items. Used screen coordinate | 81 // Returns rectangle bounding all visible shelf items. Used screen coordinate |
106 // system. | 82 // system. |
107 gfx::Rect GetVisibleItemsBoundsInScreen() const; | 83 gfx::Rect GetVisibleItemsBoundsInScreen() const; |
108 | 84 |
109 // Returns ApplicationDragAndDropHost for this shelf. | 85 // Returns ApplicationDragAndDropHost for this shelf. |
110 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 86 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
111 | 87 |
112 // Updates the background for the shelf items. | 88 // Updates the background for the shelf items. |
113 void UpdateShelfItemBackground(int alpha); | 89 void UpdateShelfItemBackground(int alpha); |
114 | 90 |
115 ShelfLockingManager* shelf_locking_manager_for_testing() { | |
116 return &shelf_locking_manager_; | |
117 } | |
118 | |
119 ShelfView* shelf_view_for_testing() { return shelf_view_; } | 91 ShelfView* shelf_view_for_testing() { return shelf_view_; } |
120 | 92 |
121 private: | 93 private: |
122 friend class test::ShelfTestAPI; | 94 friend class test::ShelfTestAPI; |
123 | 95 |
124 // The shelf controller. Owned by the root window controller. | 96 // The shelf controller. Owned by the root window controller. |
125 WmShelf* wm_shelf_; | 97 WmShelf* wm_shelf_; |
126 ShelfWidget* shelf_widget_; | 98 ShelfWidget* shelf_widget_; |
127 ShelfView* shelf_view_; | 99 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 | 100 |
133 DISALLOW_COPY_AND_ASSIGN(Shelf); | 101 DISALLOW_COPY_AND_ASSIGN(Shelf); |
134 }; | 102 }; |
135 | 103 |
136 } // namespace ash | 104 } // namespace ash |
137 | 105 |
138 #endif // ASH_COMMON_SHELF_SHELF_H_ | 106 #endif // ASH_COMMON_SHELF_SHELF_H_ |
OLD | NEW |