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

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

Issue 2288993002: ash: Move AppList support to ShelfWidget, expose ShelfWidget in WmShelf (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 #include "ash/common/shelf/shelf.h" 5 #include "ash/common/shelf/shelf.h"
6 #include "ash/common/shelf/shelf_delegate.h" 6 #include "ash/common/shelf/shelf_delegate.h"
7 #include "ash/common/shelf/shelf_item_delegate.h" 7 #include "ash/common/shelf/shelf_item_delegate.h"
8 #include "ash/common/shelf/shelf_layout_manager.h" 8 #include "ash/common/shelf/shelf_layout_manager.h"
9 #include "ash/common/shelf/shelf_locking_manager.h" 9 #include "ash/common/shelf/shelf_locking_manager.h"
10 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
(...skipping 29 matching lines...) Expand all
40 DCHECK(shelf_); 40 DCHECK(shelf_);
41 shelf_locking_manager_.reset(); 41 shelf_locking_manager_.reset();
42 shelf_ = nullptr; 42 shelf_ = nullptr;
43 } 43 }
44 44
45 void WmShelf::SetShelfLayoutManager(ShelfLayoutManager* manager) { 45 void WmShelf::SetShelfLayoutManager(ShelfLayoutManager* manager) {
46 DCHECK(!shelf_layout_manager_); 46 DCHECK(!shelf_layout_manager_);
47 DCHECK(manager); 47 DCHECK(manager);
48 shelf_layout_manager_ = manager; 48 shelf_layout_manager_ = manager;
49 shelf_layout_manager_->AddObserver(this); 49 shelf_layout_manager_->AddObserver(this);
50 DCHECK(manager->shelf_widget());
51 shelf_widget_ = manager->shelf_widget();
James Cook 2016/08/29 22:39:17 I created a new member here because I wanted outsi
msw 2016/08/29 22:58:08 Acknowledged.
50 } 52 }
51 53
52 WmWindow* WmShelf::GetWindow() { 54 WmWindow* WmShelf::GetWindow() {
53 // Use |shelf_layout_manager_| to access ShelfWidget because it is set before 55 // Use |shelf_layout_manager_| to access ShelfWidget because it is set before
54 // before the Shelf instance is available. 56 // before the Shelf instance is available.
55 return WmLookup::Get()->GetWindowForWidget( 57 return WmLookup::Get()->GetWindowForWidget(
56 shelf_layout_manager_->shelf_widget()); 58 shelf_layout_manager_->shelf_widget());
57 } 59 }
58 60
59 void WmShelf::SetAlignment(ShelfAlignment alignment) { 61 void WmShelf::SetAlignment(ShelfAlignment alignment) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 245 }
244 246
245 ShelfLockingManager* WmShelf::GetShelfLockingManagerForTesting() { 247 ShelfLockingManager* WmShelf::GetShelfLockingManagerForTesting() {
246 return shelf_locking_manager_.get(); 248 return shelf_locking_manager_.get();
247 } 249 }
248 250
249 ShelfView* WmShelf::GetShelfViewForTesting() { 251 ShelfView* WmShelf::GetShelfViewForTesting() {
250 return shelf_->shelf_view_for_testing(); 252 return shelf_->shelf_view_for_testing();
251 } 253 }
252 254
253 ShelfWidget* WmShelf::GetShelfWidgetForTesting() {
254 return shelf_layout_manager_->shelf_widget();
255 }
256
257 WmShelf::WmShelf() {} 255 WmShelf::WmShelf() {}
258 256
259 WmShelf::~WmShelf() {} 257 WmShelf::~WmShelf() {}
260 258
261 void WmShelf::WillDeleteShelfLayoutManager() { 259 void WmShelf::WillDeleteShelfLayoutManager() {
262 DCHECK(shelf_layout_manager_); 260 DCHECK(shelf_layout_manager_);
263 shelf_layout_manager_->RemoveObserver(this); 261 shelf_layout_manager_->RemoveObserver(this);
264 shelf_layout_manager_ = nullptr; 262 shelf_layout_manager_ = nullptr;
265 } 263 }
266 264
267 void WmShelf::WillChangeVisibilityState(ShelfVisibilityState new_state) { 265 void WmShelf::WillChangeVisibilityState(ShelfVisibilityState new_state) {
268 FOR_EACH_OBSERVER(WmShelfObserver, observers_, 266 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
269 WillChangeVisibilityState(new_state)); 267 WillChangeVisibilityState(new_state));
270 } 268 }
271 269
272 void WmShelf::OnAutoHideStateChanged(ShelfAutoHideState new_state) { 270 void WmShelf::OnAutoHideStateChanged(ShelfAutoHideState new_state) {
273 FOR_EACH_OBSERVER(WmShelfObserver, observers_, 271 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
274 OnAutoHideStateChanged(new_state)); 272 OnAutoHideStateChanged(new_state));
275 } 273 }
276 274
277 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, 275 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type,
278 BackgroundAnimatorChangeType change_type) { 276 BackgroundAnimatorChangeType change_type) {
279 if (background_type == GetBackgroundType()) 277 if (background_type == GetBackgroundType())
280 return; 278 return;
281 FOR_EACH_OBSERVER(WmShelfObserver, observers_, 279 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
282 OnBackgroundTypeChanged(background_type, change_type)); 280 OnBackgroundTypeChanged(background_type, change_type));
283 } 281 }
284 282
285 } // namespace ash 283 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698