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

Side by Side Diff: ash/root_window_controller.cc

Issue 2297893002: Merges RootWindowControllerCommon into WmRootWindowController (Closed)
Patch Set: feedback 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
« no previous file with comments | « ash/root_window_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "ash/aura/wm_root_window_controller_aura.h"
11 #include "ash/aura/wm_shelf_aura.h" 12 #include "ash/aura/wm_shelf_aura.h"
12 #include "ash/aura/wm_window_aura.h" 13 #include "ash/aura/wm_window_aura.h"
13 #include "ash/common/ash_constants.h" 14 #include "ash/common/ash_constants.h"
14 #include "ash/common/ash_switches.h" 15 #include "ash/common/ash_switches.h"
15 #include "ash/common/focus_cycler.h" 16 #include "ash/common/focus_cycler.h"
16 #include "ash/common/login_status.h" 17 #include "ash/common/login_status.h"
17 #include "ash/common/root_window_controller_common.h"
18 #include "ash/common/session/session_state_delegate.h" 18 #include "ash/common/session/session_state_delegate.h"
19 #include "ash/common/shelf/shelf.h" 19 #include "ash/common/shelf/shelf.h"
20 #include "ash/common/shelf/shelf_delegate.h" 20 #include "ash/common/shelf/shelf_delegate.h"
21 #include "ash/common/shelf/shelf_layout_manager.h" 21 #include "ash/common/shelf/shelf_layout_manager.h"
22 #include "ash/common/shelf/shelf_types.h" 22 #include "ash/common/shelf/shelf_types.h"
23 #include "ash/common/shelf/shelf_widget.h" 23 #include "ash/common/shelf/shelf_widget.h"
24 #include "ash/common/shell_delegate.h" 24 #include "ash/common/shell_delegate.h"
25 #include "ash/common/shell_window_ids.h" 25 #include "ash/common/shell_window_ids.h"
26 #include "ash/common/system/status_area_layout_manager.h" 26 #include "ash/common/system/status_area_layout_manager.h"
27 #include "ash/common/system/status_area_widget.h" 27 #include "ash/common/system/status_area_widget.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 aura::Window* RootWindowController::GetRootWindow() { 326 aura::Window* RootWindowController::GetRootWindow() {
327 return GetHost()->window(); 327 return GetHost()->window();
328 } 328 }
329 329
330 const aura::Window* RootWindowController::GetRootWindow() const { 330 const aura::Window* RootWindowController::GetRootWindow() const {
331 return GetHost()->window(); 331 return GetHost()->window();
332 } 332 }
333 333
334 WorkspaceController* RootWindowController::workspace_controller() { 334 WorkspaceController* RootWindowController::workspace_controller() {
335 return root_window_controller_common_->workspace_controller(); 335 return wm_root_window_controller_->workspace_controller();
336 } 336 }
337 337
338 void RootWindowController::SetWallpaperWidgetController( 338 void RootWindowController::SetWallpaperWidgetController(
339 WallpaperWidgetController* controller) { 339 WallpaperWidgetController* controller) {
340 wallpaper_widget_controller_.reset(controller); 340 wallpaper_widget_controller_.reset(controller);
341 } 341 }
342 342
343 void RootWindowController::SetAnimatingWallpaperWidgetController( 343 void RootWindowController::SetAnimatingWallpaperWidgetController(
344 AnimatingWallpaperWidgetController* controller) { 344 AnimatingWallpaperWidgetController* controller) {
345 if (animating_wallpaper_widget_controller_.get()) 345 if (animating_wallpaper_widget_controller_.get())
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 aura::Window* root_window = GetRootWindow(); 570 aura::Window* root_window = GetRootWindow();
571 aura::client::SetDragDropClient(root_window, NULL); 571 aura::client::SetDragDropClient(root_window, NULL);
572 572
573 if (shelf_widget_) 573 if (shelf_widget_)
574 shelf_widget_->Shutdown(); 574 shelf_widget_->Shutdown();
575 575
576 // Close wallpaper widget first as it depends on tooltip. 576 // Close wallpaper widget first as it depends on tooltip.
577 wallpaper_widget_controller_.reset(); 577 wallpaper_widget_controller_.reset();
578 animating_wallpaper_widget_controller_.reset(); 578 animating_wallpaper_widget_controller_.reset();
579 579
580 root_window_controller_common_->DeleteWorkspaceController(); 580 wm_root_window_controller_->DeleteWorkspaceController();
581 aura::client::SetTooltipClient(root_window, NULL); 581 aura::client::SetTooltipClient(root_window, NULL);
582 582
583 // Explicitly destroy top level windows. We do this as during part of 583 // Explicitly destroy top level windows. We do this as during part of
584 // destruction such windows may query the RootWindow for state. 584 // destruction such windows may query the RootWindow for state.
585 aura::WindowTracker non_toplevel_windows; 585 aura::WindowTracker non_toplevel_windows;
586 non_toplevel_windows.Add(root_window); 586 non_toplevel_windows.Add(root_window);
587 while (!non_toplevel_windows.windows().empty()) { 587 while (!non_toplevel_windows.windows().empty()) {
588 const aura::Window* non_toplevel_window = 588 const aura::Window* non_toplevel_window =
589 *non_toplevel_windows.windows().begin(); 589 *non_toplevel_windows.windows().begin();
590 non_toplevel_windows.Remove(const_cast<aura::Window*>(non_toplevel_window)); 590 non_toplevel_windows.Remove(const_cast<aura::Window*>(non_toplevel_window));
(...skipping 23 matching lines...) Expand all
614 shelf_widget_.reset(); 614 shelf_widget_.reset();
615 // CloseChildWindows may be called twice during the shutdown of ash unittests. 615 // CloseChildWindows may be called twice during the shutdown of ash unittests.
616 // Avoid notifying WmShelf that the Shelf instance has been destroyed twice. 616 // Avoid notifying WmShelf that the Shelf instance has been destroyed twice.
617 if (wm_shelf_aura_->shelf()) 617 if (wm_shelf_aura_->shelf())
618 wm_shelf_aura_->ClearShelf(); 618 wm_shelf_aura_->ClearShelf();
619 shelf_.reset(); 619 shelf_.reset();
620 } 620 }
621 621
622 void RootWindowController::MoveWindowsTo(aura::Window* dst) { 622 void RootWindowController::MoveWindowsTo(aura::Window* dst) {
623 // Clear the workspace controller, so it doesn't incorrectly update the shelf. 623 // Clear the workspace controller, so it doesn't incorrectly update the shelf.
624 root_window_controller_common_->DeleteWorkspaceController(); 624 wm_root_window_controller_->DeleteWorkspaceController();
625 ReparentAllWindows(GetRootWindow(), dst); 625 ReparentAllWindows(GetRootWindow(), dst);
626 } 626 }
627 627
628 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 628 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
629 return shelf_widget_->shelf_layout_manager(); 629 return shelf_widget_->shelf_layout_manager();
630 } 630 }
631 631
632 SystemTray* RootWindowController::GetSystemTray() { 632 SystemTray* RootWindowController::GetSystemTray() {
633 // We assume in throughout the code that this will not return NULL. If code 633 // We assume in throughout the code that this will not return NULL. If code
634 // triggers this for valid reasons, it should test status_area_widget first. 634 // triggers this for valid reasons, it should test status_area_widget first.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 // RootWindowController, private: 735 // RootWindowController, private:
736 736
737 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) 737 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host)
738 : ash_host_(ash_host), 738 : ash_host_(ash_host),
739 wm_shelf_aura_(new WmShelfAura), 739 wm_shelf_aura_(new WmShelfAura),
740 docked_layout_manager_(NULL), 740 docked_layout_manager_(NULL),
741 panel_layout_manager_(NULL), 741 panel_layout_manager_(NULL),
742 touch_hud_debug_(NULL), 742 touch_hud_debug_(NULL),
743 touch_hud_projection_(NULL) { 743 touch_hud_projection_(NULL) {
744 aura::Window* root_window = GetRootWindow(); 744 aura::Window* root_window = GetRootWindow();
745 root_window_controller_common_.reset(
746 new RootWindowControllerCommon(WmWindowAura::Get(root_window)));
747 GetRootWindowSettings(root_window)->controller = this; 745 GetRootWindowSettings(root_window)->controller = this;
748 746
747 // Has to happen after this is set as |controller| of RootWindowSettings.
748 wm_root_window_controller_ = WmRootWindowControllerAura::Get(root_window);
749
749 stacking_controller_.reset(new StackingController); 750 stacking_controller_.reset(new StackingController);
750 aura::client::SetWindowTreeClient(root_window, stacking_controller_.get()); 751 aura::client::SetWindowTreeClient(root_window, stacking_controller_.get());
751 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); 752 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window));
752 } 753 }
753 754
754 void RootWindowController::Init(RootWindowType root_window_type, 755 void RootWindowController::Init(RootWindowType root_window_type,
755 bool first_run_after_boot) { 756 bool first_run_after_boot) {
756 aura::Window* root_window = GetRootWindow(); 757 aura::Window* root_window = GetRootWindow();
757 Shell* shell = Shell::GetInstance(); 758 Shell* shell = Shell::GetInstance();
758 shell->InitRootWindow(root_window); 759 shell->InitRootWindow(root_window);
759 760
760 root_window_controller_common_->CreateContainers(); 761 wm_root_window_controller_->CreateContainers();
761 762
762 CreateSystemWallpaper(first_run_after_boot); 763 CreateSystemWallpaper(first_run_after_boot);
763 764
764 InitLayoutManagers(); 765 InitLayoutManagers();
765 InitTouchHuds(); 766 InitTouchHuds();
766 767
767 if (Shell::GetPrimaryRootWindowController() 768 if (Shell::GetPrimaryRootWindowController()
768 ->GetSystemModalLayoutManager(NULL) 769 ->GetSystemModalLayoutManager(NULL)
769 ->has_modal_background()) { 770 ->has_modal_background()) {
770 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); 771 GetSystemModalLayoutManager(NULL)->CreateModalBackground();
771 } 772 }
772 773
773 WmShell::Get()->AddShellObserver(this); 774 WmShell::Get()->AddShellObserver(this);
774 775
775 root_window_controller_common_->root_window_layout()->OnWindowResized(); 776 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized();
776 if (root_window_type == PRIMARY) { 777 if (root_window_type == PRIMARY) {
777 shell->InitKeyboard(); 778 shell->InitKeyboard();
778 } else { 779 } else {
779 ash_host_->AsWindowTreeHost()->Show(); 780 ash_host_->AsWindowTreeHost()->Show();
780 781
781 // Create a shelf if a user is already logged in. 782 // Create a shelf if a user is already logged in.
782 if (WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers()) 783 if (WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers())
783 CreateShelf(); 784 CreateShelf();
784 785
785 // Notify shell observers about new root window. 786 // Notify shell observers about new root window.
786 shell->OnRootWindowAdded(WmWindowAura::Get(root_window)); 787 shell->OnRootWindowAdded(WmWindowAura::Get(root_window));
787 } 788 }
788 789
789 #if defined(OS_CHROMEOS) 790 #if defined(OS_CHROMEOS)
790 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 791 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
791 switches::kAshDisableTouchExplorationMode)) { 792 switches::kAshDisableTouchExplorationMode)) {
792 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); 793 touch_exploration_manager_.reset(new AshTouchExplorationManager(this));
793 } 794 }
794 #endif 795 #endif
795 } 796 }
796 797
797 void RootWindowController::InitLayoutManagers() { 798 void RootWindowController::InitLayoutManagers() {
798 root_window_controller_common_->CreateLayoutManagers(); 799 wm_root_window_controller_->CreateLayoutManagers();
799 800
800 aura::Window* root_window = GetRootWindow(); 801 aura::Window* root_window = GetRootWindow();
801 802
802 aura::Window* modal_container = 803 aura::Window* modal_container =
803 root_window->GetChildById(kShellWindowId_SystemModalContainer); 804 root_window->GetChildById(kShellWindowId_SystemModalContainer);
804 DCHECK(modal_container); 805 DCHECK(modal_container);
805 modal_container->SetLayoutManager( 806 modal_container->SetLayoutManager(
806 new SystemModalContainerLayoutManager(modal_container)); 807 new SystemModalContainerLayoutManager(modal_container));
807 808
808 aura::Window* lock_container = 809 aura::Window* lock_container =
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 aura::Window* primary_root_window = Shell::GetInstance() 953 aura::Window* primary_root_window = Shell::GetInstance()
953 ->window_tree_host_manager() 954 ->window_tree_host_manager()
954 ->GetPrimaryRootWindow(); 955 ->GetPrimaryRootWindow();
955 return GetRootWindowSettings(primary_root_window)->controller; 956 return GetRootWindowSettings(primary_root_window)->controller;
956 } 957 }
957 958
958 return GetRootWindowSettings(root_window)->controller; 959 return GetRootWindowSettings(root_window)->controller;
959 } 960 }
960 961
961 } // namespace ash 962 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698