Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: ash/common/shelf/wm_shelf.h

Issue 2293183002: ash: Remove ash::Shelf in favor of ash::WmShelf (Closed)
Patch Set: rebase again Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/shelf/shelf_widget.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 void InitializeShelf();
52 void ShutdownShelf();
53
54 // True after the ShelfView has been created (e.g. after login).
55 bool IsShelfInitialized() const;
56
54 // Returns the window showing the shelf. 57 // Returns the window showing the shelf.
55 WmWindow* GetWindow(); 58 WmWindow* GetWindow();
56 59
57 ShelfAlignment alignment() const { return alignment_; } 60 ShelfAlignment alignment() const { return alignment_; }
58 // TODO(jamescook): Replace with alignment(). 61 // TODO(jamescook): Replace with alignment().
59 ShelfAlignment GetAlignment() const { return alignment_; } 62 ShelfAlignment GetAlignment() const { return alignment_; }
60 void SetAlignment(ShelfAlignment alignment); 63 void SetAlignment(ShelfAlignment alignment);
61 64
62 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). 65 // Returns true if the shelf alignment is horizontal (i.e. at the bottom).
63 bool IsHorizontalAlignment() const; 66 bool IsHorizontalAlignment() const;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ~WmShelf() override; 144 ~WmShelf() override;
142 145
143 // ShelfLayoutManagerObserver: 146 // ShelfLayoutManagerObserver:
144 void WillDeleteShelfLayoutManager() override; 147 void WillDeleteShelfLayoutManager() override;
145 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; 148 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
146 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; 149 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
147 void OnBackgroundUpdated(ShelfBackgroundType background_type, 150 void OnBackgroundUpdated(ShelfBackgroundType background_type,
148 BackgroundAnimatorChangeType change_type) override; 151 BackgroundAnimatorChangeType change_type) override;
149 152
150 private: 153 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 154 // Layout manager for the shelf container window. Instances are constructed by
156 // ShelfWidget and lifetimes are managed by the container windows themselves. 155 // ShelfWidget and lifetimes are managed by the container windows themselves.
157 ShelfLayoutManager* shelf_layout_manager_ = nullptr; 156 ShelfLayoutManager* shelf_layout_manager_ = nullptr;
158 157
159 // TODO(jamescook): Move ShelfWidget ownership here. 158 // TODO(jamescook): Move ShelfWidget ownership here.
160 ShelfWidget* shelf_widget_ = nullptr; 159 ShelfWidget* shelf_widget_ = nullptr;
161 160
161 // Internal implementation detail. Do not expose externally. Owned by views
162 // hierarchy. Null before login and in secondary display init.
163 ShelfView* shelf_view_ = nullptr;
164
162 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; 165 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED;
163 166
164 // Sets shelf alignment to bottom during login and screen lock. 167 // Sets shelf alignment to bottom during login and screen lock.
165 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; 168 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_;
166 169
167 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; 170 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
168 171
169 base::ObserverList<WmShelfObserver> observers_; 172 base::ObserverList<WmShelfObserver> observers_;
170 173
171 DISALLOW_COPY_AND_ASSIGN(WmShelf); 174 DISALLOW_COPY_AND_ASSIGN(WmShelf);
172 }; 175 };
173 176
174 } // namespace ash 177 } // namespace ash
175 178
176 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ 179 #endif // ASH_COMMON_SHELF_WM_SHELF_H_
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_widget.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698