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

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

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 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/shelf/shelf_widget.h" 5 #include "ash/shelf/shelf_widget.h"
6 6
7 #include "ash/aura/wm_shelf_aura.h" 7 #include "ash/aura/wm_shelf_aura.h"
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/focus_cycler.h" 10 #include "ash/common/focus_cycler.h"
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 WmWindowAura::GetAuraWindow(wm_shelf_container); 589 WmWindowAura::GetAuraWindow(wm_shelf_container);
590 shelf_container->SetLayoutManager(shelf_layout_manager_); 590 shelf_container->SetLayoutManager(shelf_layout_manager_);
591 shelf_layout_manager_->set_workspace_controller(workspace_controller); 591 shelf_layout_manager_->set_workspace_controller(workspace_controller);
592 workspace_controller->SetShelf(shelf_layout_manager_); 592 workspace_controller->SetShelf(shelf_layout_manager_);
593 wm_shelf_aura->SetShelfLayoutManager(shelf_layout_manager_); 593 wm_shelf_aura->SetShelfLayoutManager(shelf_layout_manager_);
594 594
595 // TODO(jamescook): Move ownership to RootWindowController. 595 // TODO(jamescook): Move ownership to RootWindowController.
596 status_area_widget_ = 596 status_area_widget_ =
597 new StatusAreaWidget(wm_status_container, wm_shelf_aura); 597 new StatusAreaWidget(wm_status_container, wm_shelf_aura);
598 status_area_widget_->CreateTrayViews(); 598 status_area_widget_->CreateTrayViews();
599 if (Shell::GetInstance() 599 if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted())
600 ->session_state_delegate()
601 ->IsActiveUserSessionStarted()) {
602 status_area_widget_->Show(); 600 status_area_widget_->Show();
603 }
604 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_); 601 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_);
605 602
606 aura::Window* status_container = 603 aura::Window* status_container =
607 WmWindowAura::GetAuraWindow(wm_status_container); 604 WmWindowAura::GetAuraWindow(wm_status_container);
608 status_container->SetLayoutManager( 605 status_container->SetLayoutManager(
609 new StatusAreaLayoutManager(status_container, this)); 606 new StatusAreaLayoutManager(status_container, this));
610 607
611 shelf_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( 608 shelf_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>(
612 new ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); 609 new ShelfWindowTargeter(shelf_container, shelf_layout_manager_)));
613 status_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( 610 status_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 shelf_.reset(new Shelf(shell->shelf_model(), delegate, wm_shelf_aura, this)); 731 shelf_.reset(new Shelf(shell->shelf_model(), delegate, wm_shelf_aura, this));
735 // Must be initialized before the delegate is notified because the delegate 732 // Must be initialized before the delegate is notified because the delegate
736 // may try to access the WmShelf. 733 // may try to access the WmShelf.
737 wm_shelf_aura->SetShelf(shelf_.get()); 734 wm_shelf_aura->SetShelf(shelf_.get());
738 delegate->OnShelfCreated(shelf_.get()); 735 delegate->OnShelfCreated(shelf_.get());
739 736
740 SetFocusCycler(WmShell::Get()->focus_cycler()); 737 SetFocusCycler(WmShell::Get()->focus_cycler());
741 } 738 }
742 739
743 void ShelfWidget::PostCreateShelf() { 740 void ShelfWidget::PostCreateShelf() {
744 shelf_->SetVisible(Shell::GetInstance() 741 shelf_->SetVisible(
745 ->session_state_delegate() 742 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted());
746 ->IsActiveUserSessionStarted());
747 shelf_layout_manager_->LayoutShelf(); 743 shelf_layout_manager_->LayoutShelf();
748 shelf_layout_manager_->UpdateAutoHideState(); 744 shelf_layout_manager_->UpdateAutoHideState();
749 Show(); 745 Show();
750 } 746 }
751 747
752 bool ShelfWidget::IsShelfVisible() const { 748 bool ShelfWidget::IsShelfVisible() const {
753 return shelf_.get() && shelf_->IsVisible(); 749 return shelf_.get() && shelf_->IsVisible();
754 } 750 }
755 751
756 void ShelfWidget::SetShelfVisibility(bool visible) { 752 void ShelfWidget::SetShelfVisibility(bool visible) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); 820 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event);
825 } 821 }
826 822
827 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { 823 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) {
828 Widget::OnGestureEvent(event); 824 Widget::OnGestureEvent(event);
829 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) 825 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_)
830 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); 826 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event);
831 } 827 }
832 828
833 } // namespace ash 829 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698