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

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

Issue 2272793005: ash: Move alignment and autohide behavior from Shelf to WmShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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_layout_manager.cc ('k') | ash/common/shelf/wm_shelf.h » ('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 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/common/focus_cycler.h" 7 #include "ash/common/focus_cycler.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/shelf_background_animator_observer.h" 10 #include "ash/common/shelf/shelf_background_animator_observer.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 shelf_container->GetRootWindowController() 306 shelf_container->GetRootWindowController()
307 ->ConfigureWidgetInitParamsForContainer( 307 ->ConfigureWidgetInitParamsForContainer(
308 this, shelf_container->GetShellWindowId(), &params); 308 this, shelf_container->GetShellWindowId(), &params);
309 Init(params); 309 Init(params);
310 310
311 // The shelf should not take focus when initially shown. 311 // The shelf should not take focus when initially shown.
312 set_focus_on_creation(false); 312 set_focus_on_creation(false);
313 SetContentsView(delegate_view_); 313 SetContentsView(delegate_view_);
314 delegate_view_->SetParentLayer(GetLayer()); 314 delegate_view_->SetParentLayer(GetLayer());
315 315
316 shelf_layout_manager_ = new ShelfLayoutManager(this); 316 shelf_layout_manager_ = new ShelfLayoutManager(this, wm_shelf_);
317 shelf_layout_manager_->AddObserver(this); 317 shelf_layout_manager_->AddObserver(this);
318 shelf_container->SetLayoutManager(base::WrapUnique(shelf_layout_manager_)); 318 shelf_container->SetLayoutManager(base::WrapUnique(shelf_layout_manager_));
319 background_animator_.PaintBackground( 319 background_animator_.PaintBackground(
320 shelf_layout_manager_->GetShelfBackgroundType(), 320 shelf_layout_manager_->GetShelfBackgroundType(),
321 BACKGROUND_CHANGE_IMMEDIATE); 321 BACKGROUND_CHANGE_IMMEDIATE);
322 wm_shelf_->SetShelfLayoutManager(shelf_layout_manager_); 322 wm_shelf_->SetShelfLayoutManager(shelf_layout_manager_);
323 323
324 // TODO(jamescook): Move ownership to RootWindowController. 324 // TODO(jamescook): Move ownership to RootWindowController.
325 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_); 325 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_);
326 status_area_widget_->CreateTrayViews(); 326 status_area_widget_->CreateTrayViews();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 400
401 NOTREACHED(); 401 NOTREACHED();
402 return false; 402 return false;
403 } 403 }
404 404
405 ShelfAlignment ShelfWidget::GetAlignment() const { 405 ShelfAlignment ShelfWidget::GetAlignment() const {
406 return wm_shelf_->GetAlignment(); 406 return wm_shelf_->GetAlignment();
407 } 407 }
408 408
409 void ShelfWidget::OnShelfAlignmentChanged() { 409 void ShelfWidget::OnShelfAlignmentChanged() {
410 shelf_view_->OnShelfAlignmentChanged();
410 status_area_widget_->SetShelfAlignment(GetAlignment()); 411 status_area_widget_->SetShelfAlignment(GetAlignment());
411 delegate_view_->SchedulePaint(); 412 delegate_view_->SchedulePaint();
412 } 413 }
413 414
414 void ShelfWidget::SetDimsShelf(bool dimming) { 415 void ShelfWidget::SetDimsShelf(bool dimming) {
415 delegate_view_->SetDimmed(dimming); 416 delegate_view_->SetDimmed(dimming);
416 // Repaint all children, allowing updates to reflect dimmed state eg: 417 // Repaint all children, allowing updates to reflect dimmed state eg:
417 // status area background, app list button and overflow button. 418 // status area background, app list button and overflow button.
418 if (shelf_view_) 419 if (shelf_view_)
419 shelf_view_->SchedulePaintForAllButtons(); 420 shelf_view_->SchedulePaintForAllButtons();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 if (shelf_view_) 531 if (shelf_view_)
531 shelf_view_->UpdateShelfItemBackground(alpha); 532 shelf_view_->UpdateShelfItemBackground(alpha);
532 } 533 }
533 534
534 void ShelfWidget::WillDeleteShelfLayoutManager() { 535 void ShelfWidget::WillDeleteShelfLayoutManager() {
535 shelf_layout_manager_->RemoveObserver(this); 536 shelf_layout_manager_->RemoveObserver(this);
536 shelf_layout_manager_ = nullptr; 537 shelf_layout_manager_ = nullptr;
537 } 538 }
538 539
539 } // namespace ash 540 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_layout_manager.cc ('k') | ash/common/shelf/wm_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698