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

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

Issue 2304443002: ash: Move ShelfWidget ownership to WmShelf and refactor access to it (Closed)
Patch Set: 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
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"
(...skipping 21 matching lines...) Expand all
32 class WmWindow; 32 class WmWindow;
33 33
34 // 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
35 // 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.
36 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { 36 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver {
37 public: 37 public:
38 // 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
39 // widget may not exist, or the shelf may not be visible. 39 // widget may not exist, or the shelf may not be visible.
40 static WmShelf* ForWindow(WmWindow* window); 40 static WmShelf* ForWindow(WmWindow* window);
41 41
42 // TODO(jamescook): Create the ShelfLayoutManager in this class. 42 virtual void CreateShelfWidget(WmWindow* root);
James Cook 2016/08/31 22:18:08 Ugly, but at least it makes the steps explicit.
43 virtual void SetShelfLayoutManager(ShelfLayoutManager* manager); 43 void ShutdownShelfWidget();
44 void DestroyShelfWidget();
45
44 ShelfLayoutManager* shelf_layout_manager() const { 46 ShelfLayoutManager* shelf_layout_manager() const {
45 return shelf_layout_manager_; 47 return shelf_layout_manager_;
46 } 48 }
47 49
48 ShelfWidget* shelf_widget() { return shelf_widget_; } 50 ShelfWidget* shelf_widget() { return shelf_widget_.get(); }
49 51
50 // Creates the shelf view. 52 // Creates the shelf view.
51 void InitializeShelf(); 53 void InitializeShelf();
52 void ShutdownShelf(); 54 void ShutdownShelf();
53 55
54 // True after the ShelfView has been created (e.g. after login). 56 // True after the ShelfView has been created (e.g. after login).
55 bool IsShelfInitialized() const; 57 bool IsShelfInitialized() const;
56 58
57 // Returns the window showing the shelf. 59 // Returns the window showing the shelf.
58 WmWindow* GetWindow(); 60 WmWindow* GetWindow();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; 150 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
149 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; 151 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
150 void OnBackgroundUpdated(ShelfBackgroundType background_type, 152 void OnBackgroundUpdated(ShelfBackgroundType background_type,
151 BackgroundAnimatorChangeType change_type) override; 153 BackgroundAnimatorChangeType change_type) override;
152 154
153 private: 155 private:
154 // Layout manager for the shelf container window. Instances are constructed by 156 // Layout manager for the shelf container window. Instances are constructed by
155 // ShelfWidget and lifetimes are managed by the container windows themselves. 157 // ShelfWidget and lifetimes are managed by the container windows themselves.
156 ShelfLayoutManager* shelf_layout_manager_ = nullptr; 158 ShelfLayoutManager* shelf_layout_manager_ = nullptr;
157 159
158 // TODO(jamescook): Move ShelfWidget ownership here. 160 std::unique_ptr<ShelfWidget> shelf_widget_;
159 ShelfWidget* shelf_widget_ = nullptr;
160 161
161 // Internal implementation detail. Do not expose externally. Owned by views 162 // Internal implementation detail. Do not expose externally. Owned by views
162 // hierarchy. Null before login and in secondary display init. 163 // hierarchy. Null before login and in secondary display init.
163 ShelfView* shelf_view_ = nullptr; 164 ShelfView* shelf_view_ = nullptr;
164 165
165 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; 166 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED;
166 167
167 // Sets shelf alignment to bottom during login and screen lock. 168 // Sets shelf alignment to bottom during login and screen lock.
168 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_; 169 std::unique_ptr<ShelfLockingManager> shelf_locking_manager_;
169 170
170 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; 171 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
171 172
172 base::ObserverList<WmShelfObserver> observers_; 173 base::ObserverList<WmShelfObserver> observers_;
173 174
174 DISALLOW_COPY_AND_ASSIGN(WmShelf); 175 DISALLOW_COPY_AND_ASSIGN(WmShelf);
175 }; 176 };
176 177
177 } // namespace ash 178 } // namespace ash
178 179
179 #endif // ASH_COMMON_SHELF_WM_SHELF_H_ 180 #endif // ASH_COMMON_SHELF_WM_SHELF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698