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

Side by Side Diff: ash/root_window_controller.cc

Issue 2243513004: mash: Partially migrate WorkspaceController to ash common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/aura/aura_layout_manager_adapter.h" 10 #include "ash/aura/aura_layout_manager_adapter.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 delete window; 604 delete window;
605 } else { 605 } else {
606 root_window->RemoveChild(window); 606 root_window->RemoveChild(window);
607 } 607 }
608 } 608 }
609 609
610 shelf_widget_.reset(); 610 shelf_widget_.reset();
611 } 611 }
612 612
613 void RootWindowController::MoveWindowsTo(aura::Window* dst) { 613 void RootWindowController::MoveWindowsTo(aura::Window* dst) {
614 // Clear the shelf first, so it doesn't update itself with wrong display info. 614 // Clear the workspace controller, so it doesn't incorrectly update the shelf.
615 workspace_controller_->SetShelf(nullptr); 615 workspace_controller_.reset();
616 ReparentAllWindows(GetRootWindow(), dst); 616 ReparentAllWindows(GetRootWindow(), dst);
617 } 617 }
618 618
619 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 619 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
620 return shelf_widget_->shelf_layout_manager(); 620 return shelf_widget_->shelf_layout_manager();
621 } 621 }
622 622
623 SystemTray* RootWindowController::GetSystemTray() { 623 SystemTray* RootWindowController::GetSystemTray() {
624 // We assume in throughout the code that this will not return NULL. If code 624 // We assume in throughout the code that this will not return NULL. If code
625 // triggers this for valid reasons, it should test status_area_widget first. 625 // triggers this for valid reasons, it should test status_area_widget first.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); 783 touch_exploration_manager_.reset(new AshTouchExplorationManager(this));
784 } 784 }
785 #endif 785 #endif
786 } 786 }
787 787
788 void RootWindowController::InitLayoutManagers() { 788 void RootWindowController::InitLayoutManagers() {
789 root_window_controller_common_->CreateLayoutManagers(); 789 root_window_controller_common_->CreateLayoutManagers();
790 790
791 aura::Window* root_window = GetRootWindow(); 791 aura::Window* root_window = GetRootWindow();
792 792
793 aura::Window* default_container =
794 GetContainer(kShellWindowId_DefaultContainer);
795 // Workspace manager has its own layout managers.
796
797 aura::Window* modal_container = 793 aura::Window* modal_container =
798 root_window->GetChildById(kShellWindowId_SystemModalContainer); 794 root_window->GetChildById(kShellWindowId_SystemModalContainer);
799 DCHECK(modal_container); 795 DCHECK(modal_container);
800 modal_container->SetLayoutManager( 796 modal_container->SetLayoutManager(
801 new SystemModalContainerLayoutManager(modal_container)); 797 new SystemModalContainerLayoutManager(modal_container));
802 798
803 aura::Window* lock_container = 799 aura::Window* lock_container =
804 root_window->GetChildById(kShellWindowId_LockScreenContainer); 800 root_window->GetChildById(kShellWindowId_LockScreenContainer);
805 DCHECK(lock_container); 801 DCHECK(lock_container);
806 lock_container->SetLayoutManager(new LockLayoutManager(lock_container)); 802 lock_container->SetLayoutManager(new LockLayoutManager(lock_container));
807 803
808 aura::Window* lock_modal_container = 804 aura::Window* lock_modal_container =
809 root_window->GetChildById(kShellWindowId_LockSystemModalContainer); 805 root_window->GetChildById(kShellWindowId_LockSystemModalContainer);
810 DCHECK(lock_modal_container); 806 DCHECK(lock_modal_container);
811 lock_modal_container->SetLayoutManager( 807 lock_modal_container->SetLayoutManager(
812 new SystemModalContainerLayoutManager(lock_modal_container)); 808 new SystemModalContainerLayoutManager(lock_modal_container));
813 809
810 WmWindow* default_container =
811 WmWindowAura::Get(GetContainer(kShellWindowId_DefaultContainer));
814 workspace_controller_.reset(new WorkspaceController(default_container)); 812 workspace_controller_.reset(new WorkspaceController(default_container));
815 813
816 WmWindow* always_on_top_container = 814 WmWindow* always_on_top_container =
817 WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer)); 815 WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer));
818 always_on_top_controller_.reset( 816 always_on_top_controller_.reset(
819 new AlwaysOnTopController(always_on_top_container)); 817 new AlwaysOnTopController(always_on_top_container));
820 818
821 // Create the shelf and status area widgets. 819 // Create the shelf and status area widgets.
822 DCHECK(!shelf_widget_.get()); 820 DCHECK(!shelf_widget_.get());
823 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); 821 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer);
824 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); 822 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer);
825 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container); 823 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container);
826 WmWindow* wm_status_container = WmWindowAura::Get(status_container); 824 WmWindow* wm_status_container = WmWindowAura::Get(status_container);
827 shelf_widget_.reset(new ShelfWidget(wm_shelf_container, wm_status_container, 825 shelf_widget_.reset(new ShelfWidget(wm_shelf_container, wm_status_container,
828 wm_shelf_aura_.get(), 826 wm_shelf_aura_.get()));
829 workspace_controller()));
830 // Make it easier to resize windows that partially overlap the shelf. Must 827 // Make it easier to resize windows that partially overlap the shelf. Must
831 // occur after the ShelfLayoutManager is constructed by ShelfWidget. 828 // occur after the ShelfLayoutManager is constructed by ShelfWidget.
832 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( 829 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>(
833 wm_shelf_container, wm_shelf_aura_.get())); 830 wm_shelf_container, wm_shelf_aura_.get()));
834 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( 831 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>(
835 wm_status_container, wm_shelf_aura_.get())); 832 wm_status_container, wm_shelf_aura_.get()));
836 833
837 if (!WmShell::Get() 834 if (!WmShell::Get()
838 ->GetSessionStateDelegate() 835 ->GetSessionStateDelegate()
839 ->IsActiveUserSessionStarted()) { 836 ->IsActiveUserSessionStarted()) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 aura::Window* primary_root_window = Shell::GetInstance() 948 aura::Window* primary_root_window = Shell::GetInstance()
952 ->window_tree_host_manager() 949 ->window_tree_host_manager()
953 ->GetPrimaryRootWindow(); 950 ->GetPrimaryRootWindow();
954 return GetRootWindowSettings(primary_root_window)->controller; 951 return GetRootWindowSettings(primary_root_window)->controller;
955 } 952 }
956 953
957 return GetRootWindowSettings(root_window)->controller; 954 return GetRootWindowSettings(root_window)->controller;
958 } 955 }
959 956
960 } // namespace ash 957 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698