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" |
11 #include "ash/common/shelf/shelf_layout_manager_observer.h" | 11 #include "ash/common/shelf/shelf_layout_manager_observer.h" |
12 #include "ash/common/shelf/shelf_types.h" | 12 #include "ash/common/shelf/shelf_types.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Rect; | 16 class Rect; |
17 } | 17 } |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 class GestureEvent; | 20 class GestureEvent; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 | 24 |
25 class Shelf; | |
26 class ShelfLayoutManager; | 25 class ShelfLayoutManager; |
27 class ShelfLockingManager; | 26 class ShelfLockingManager; |
28 class ShelfView; | 27 class ShelfView; |
29 class ShelfWidget; | 28 class ShelfWidget; |
30 class StatusAreaWidget; | 29 class StatusAreaWidget; |
31 class WmDimmerView; | 30 class WmDimmerView; |
32 class WmShelfObserver; | 31 class WmShelfObserver; |
33 class WmWindow; | 32 class WmWindow; |
34 | 33 |
35 // Controller for the shelf state. Exists for the lifetime of each root window | 34 // 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. | 35 // controller. Note that the shelf widget may not be created until after login. |
37 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { | 36 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { |
38 public: | 37 public: |
39 // Returns the shelf for the display that |window| is on. Note that the shelf | 38 // 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. | 39 // widget may not exist, or the shelf may not be visible. |
41 static WmShelf* ForWindow(WmWindow* window); | 40 static WmShelf* ForWindow(WmWindow* window); |
42 | 41 |
43 void SetShelf(Shelf* shelf); | 42 // TODO(jamescook): Create the ShelfLayoutManager in this class. |
44 void ClearShelf(); | |
45 Shelf* shelf() const { return shelf_; } | |
46 | |
47 virtual void SetShelfLayoutManager(ShelfLayoutManager* manager); | 43 virtual void SetShelfLayoutManager(ShelfLayoutManager* manager); |
48 ShelfLayoutManager* shelf_layout_manager() const { | 44 ShelfLayoutManager* shelf_layout_manager() const { |
49 return shelf_layout_manager_; | 45 return shelf_layout_manager_; |
50 } | 46 } |
51 | 47 |
52 ShelfWidget* shelf_widget() { return shelf_widget_; } | 48 ShelfWidget* shelf_widget() { return shelf_widget_; } |
53 | 49 |
50 // Creates the shelf view. | |
51 // TODO(jamescook): Make this create the shelf widget instead. | |
msw
2016/08/30 22:02:07
nit: I'm not sure about this TODO; it might make s
James Cook
2016/08/30 23:00:56
Removed the comment. I'm still not sure about the
| |
52 void CreateShelf(); | |
msw
2016/08/30 22:02:07
nit: "InitializeShelf" or similar?
James Cook
2016/08/30 23:00:57
Done.
| |
53 void DestroyShelf(); | |
msw
2016/08/30 22:02:07
nit: "ShutdownShelf" or similar?
James Cook
2016/08/30 23:00:57
Done.
| |
54 | |
55 // True after the ShelfView has been created (e.g. after login). | |
56 bool IsShelfCreated() const; | |
msw
2016/08/30 22:02:07
optional nit: "IsShelfInitialized" or similar?
James Cook
2016/08/30 23:00:57
Done.
| |
57 | |
54 // Returns the window showing the shelf. | 58 // Returns the window showing the shelf. |
55 WmWindow* GetWindow(); | 59 WmWindow* GetWindow(); |
56 | 60 |
57 ShelfAlignment alignment() const { return alignment_; } | 61 ShelfAlignment alignment() const { return alignment_; } |
58 // TODO(jamescook): Replace with alignment(). | 62 // TODO(jamescook): Replace with alignment(). |
59 ShelfAlignment GetAlignment() const { return alignment_; } | 63 ShelfAlignment GetAlignment() const { return alignment_; } |
60 void SetAlignment(ShelfAlignment alignment); | 64 void SetAlignment(ShelfAlignment alignment); |
61 | 65 |
62 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). | 66 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). |
63 bool IsHorizontalAlignment() const; | 67 bool IsHorizontalAlignment() const; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 ~WmShelf() override; | 145 ~WmShelf() override; |
142 | 146 |
143 // ShelfLayoutManagerObserver: | 147 // ShelfLayoutManagerObserver: |
144 void WillDeleteShelfLayoutManager() override; | 148 void WillDeleteShelfLayoutManager() override; |
145 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 149 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
146 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | 150 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
147 void OnBackgroundUpdated(ShelfBackgroundType background_type, | 151 void OnBackgroundUpdated(ShelfBackgroundType background_type, |
148 BackgroundAnimatorChangeType change_type) override; | 152 BackgroundAnimatorChangeType change_type) override; |
149 | 153 |
150 private: | 154 private: |
151 // Legacy shelf controller. Null before login and in secondary display init. | |
152 // Instance lifetimes are managed by ash::RootWindowController and WmShelfMus. | |
153 Shelf* shelf_ = nullptr; | |
154 | |
155 // Layout manager for the shelf container window. Instances are constructed by | 155 // Layout manager for the shelf container window. Instances are constructed by |
156 // ShelfWidget and lifetimes are managed by the container windows themselves. | 156 // ShelfWidget and lifetimes are managed by the container windows themselves. |
157 ShelfLayoutManager* shelf_layout_manager_ = nullptr; | 157 ShelfLayoutManager* shelf_layout_manager_ = nullptr; |
158 | 158 |
159 // TODO(jamescook): Move ShelfWidget ownership here. | 159 // TODO(jamescook): Move ShelfWidget ownership here. |
160 ShelfWidget* shelf_widget_ = nullptr; | 160 ShelfWidget* shelf_widget_ = nullptr; |
161 | 161 |
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 | |
162 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; | 166 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; |
163 | 167 |
164 // Sets shelf alignment to bottom during login and screen lock. | 168 // Sets shelf alignment to bottom during login and screen lock. |
165 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; | 169 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; |
166 | 170 |
167 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 171 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
168 | 172 |
169 base::ObserverList<WmShelfObserver> observers_; | 173 base::ObserverList<WmShelfObserver> observers_; |
170 | 174 |
171 DISALLOW_COPY_AND_ASSIGN(WmShelf); | 175 DISALLOW_COPY_AND_ASSIGN(WmShelf); |
172 }; | 176 }; |
173 | 177 |
174 } // namespace ash | 178 } // namespace ash |
175 | 179 |
176 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ | 180 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ |
OLD | NEW |