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

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

Issue 2761373002: Move yet more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_widget.h" 5 #include "ash/common/shelf/shelf_widget.h"
6 6
7 #include "ash/animation/animation_change_type.h" 7 #include "ash/animation/animation_change_type.h"
8 #include "ash/common/focus_cycler.h" 8 #include "ash/common/focus_cycler.h"
9 #include "ash/common/session/session_controller.h" 9 #include "ash/common/session/session_controller.h"
10 #include "ash/common/shelf/app_list_button.h" 10 #include "ash/common/shelf/app_list_button.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 background_animator_.RemoveObserver(delegate_view_); 176 background_animator_.RemoveObserver(delegate_view_);
177 background_animator_.RemoveObserver(this); 177 background_animator_.RemoveObserver(this);
178 } 178 }
179 179
180 void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) { 180 void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) {
181 DCHECK(status_container); 181 DCHECK(status_container);
182 DCHECK(!status_area_widget_); 182 DCHECK(!status_area_widget_);
183 // TODO(jamescook): Move ownership to RootWindowController. 183 // TODO(jamescook): Move ownership to RootWindowController.
184 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_); 184 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_);
185 status_area_widget_->CreateTrayViews(); 185 status_area_widget_->CreateTrayViews();
186 if (WmShell::Get()->session_controller()->IsActiveUserSessionStarted()) 186 if (Shell::Get()->session_controller()->IsActiveUserSessionStarted())
187 status_area_widget_->Show(); 187 status_area_widget_->Show();
188 Shell::Get()->focus_cycler()->AddWidget(status_area_widget_); 188 Shell::Get()->focus_cycler()->AddWidget(status_area_widget_);
189 background_animator_.AddObserver(status_area_widget_); 189 background_animator_.AddObserver(status_area_widget_);
190 status_container->SetLayoutManager( 190 status_container->SetLayoutManager(
191 base::MakeUnique<StatusAreaLayoutManager>(this)); 191 base::MakeUnique<StatusAreaLayoutManager>(this));
192 } 192 }
193 193
194 void ShelfWidget::SetPaintsBackground(ShelfBackgroundType background_type, 194 void ShelfWidget::SetPaintsBackground(ShelfBackgroundType background_type,
195 AnimationChangeType change_type) { 195 AnimationChangeType change_type) {
196 background_animator_.PaintBackground(background_type, change_type); 196 background_animator_.PaintBackground(background_type, change_type);
(...skipping 27 matching lines...) Expand all
224 void ShelfWidget::OnShelfAlignmentChanged() { 224 void ShelfWidget::OnShelfAlignmentChanged() {
225 shelf_view_->OnShelfAlignmentChanged(); 225 shelf_view_->OnShelfAlignmentChanged();
226 // TODO(jamescook): Status area should not cache alignment. 226 // TODO(jamescook): Status area should not cache alignment.
227 status_area_widget_->SetShelfAlignment(wm_shelf_->GetAlignment()); 227 status_area_widget_->SetShelfAlignment(wm_shelf_->GetAlignment());
228 delegate_view_->SchedulePaint(); 228 delegate_view_->SchedulePaint();
229 } 229 }
230 230
231 ShelfView* ShelfWidget::CreateShelfView() { 231 ShelfView* ShelfWidget::CreateShelfView() {
232 DCHECK(!shelf_view_); 232 DCHECK(!shelf_view_);
233 233
234 shelf_view_ = 234 shelf_view_ = new ShelfView(Shell::Get()->shelf_model(),
235 new ShelfView(WmShell::Get()->shelf_model(), 235 Shell::Get()->shelf_delegate(), wm_shelf_, this);
236 WmShell::Get()->shelf_delegate(), wm_shelf_, this);
237 shelf_view_->Init(); 236 shelf_view_->Init();
238 GetContentsView()->AddChildView(shelf_view_); 237 GetContentsView()->AddChildView(shelf_view_);
239 return shelf_view_; 238 return shelf_view_;
240 } 239 }
241 240
242 void ShelfWidget::PostCreateShelf() { 241 void ShelfWidget::PostCreateShelf() {
243 SetFocusCycler(Shell::Get()->focus_cycler()); 242 SetFocusCycler(Shell::Get()->focus_cycler());
244 243
245 // Ensure the newly created |shelf_| gets current values. 244 // Ensure the newly created |shelf_| gets current values.
246 background_animator_.NotifyObserver(this); 245 background_animator_.NotifyObserver(this);
247 246
248 // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed 247 // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed
249 // because the shelf is only created after the first user session is active. 248 // because the shelf is only created after the first user session is active.
250 // The ShelfView seems to always be visible after login. At the lock screen 249 // The ShelfView seems to always be visible after login. At the lock screen
251 // the shelf is hidden because its container is hidden. During auto-hide it is 250 // the shelf is hidden because its container is hidden. During auto-hide it is
252 // hidden because ShelfWidget is transparent. Some of the ShelfView visibility 251 // hidden because ShelfWidget is transparent. Some of the ShelfView visibility
253 // code could be simplified. http://crbug.com/674773 252 // code could be simplified. http://crbug.com/674773
254 shelf_view_->SetVisible( 253 shelf_view_->SetVisible(
255 WmShell::Get()->session_controller()->IsActiveUserSessionStarted()); 254 Shell::Get()->session_controller()->IsActiveUserSessionStarted());
256 shelf_layout_manager_->LayoutShelf(); 255 shelf_layout_manager_->LayoutShelf();
257 shelf_layout_manager_->UpdateAutoHideState(); 256 shelf_layout_manager_->UpdateAutoHideState();
258 Show(); 257 Show();
259 } 258 }
260 259
261 bool ShelfWidget::IsShelfVisible() const { 260 bool ShelfWidget::IsShelfVisible() const {
262 return shelf_view_ && shelf_view_->visible(); 261 return shelf_view_ && shelf_view_->visible();
263 } 262 }
264 263
265 bool ShelfWidget::IsShowingAppList() const { 264 bool ShelfWidget::IsShowingAppList() const {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (shelf_view_) 349 if (shelf_view_)
351 shelf_view_->UpdateShelfItemBackground(color); 350 shelf_view_->UpdateShelfItemBackground(color);
352 } 351 }
353 352
354 void ShelfWidget::WillDeleteShelfLayoutManager() { 353 void ShelfWidget::WillDeleteShelfLayoutManager() {
355 shelf_layout_manager_->RemoveObserver(this); 354 shelf_layout_manager_->RemoveObserver(this);
356 shelf_layout_manager_ = nullptr; 355 shelf_layout_manager_ = nullptr;
357 } 356 }
358 357
359 } // namespace ash 358 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_locking_manager.cc ('k') | ash/common/shelf/shelf_window_watcher_item_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698