OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 GetRootWindowSettings(root_window)->controller = this; | 733 GetRootWindowSettings(root_window)->controller = this; |
734 | 734 |
735 stacking_controller_.reset(new StackingController); | 735 stacking_controller_.reset(new StackingController); |
736 aura::client::SetWindowParentingClient(root_window, | 736 aura::client::SetWindowParentingClient(root_window, |
737 stacking_controller_.get()); | 737 stacking_controller_.get()); |
738 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); | 738 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); |
739 } | 739 } |
740 | 740 |
741 void RootWindowController::Init(RootWindowType root_window_type) { | 741 void RootWindowController::Init(RootWindowType root_window_type) { |
742 aura::Window* root_window = GetRootWindow(); | 742 aura::Window* root_window = GetRootWindow(); |
743 ShellPort* shell_port = ShellPort::Get(); | |
744 Shell* shell = Shell::Get(); | 743 Shell* shell = Shell::Get(); |
745 shell->InitRootWindow(root_window); | 744 shell->InitRootWindow(root_window); |
746 | 745 |
747 CreateContainers(); | 746 CreateContainers(); |
748 ShellPort::Get()->OnCreatedRootWindowContainers(this); | 747 ShellPort::Get()->OnCreatedRootWindowContainers(this); |
749 | 748 |
750 CreateSystemWallpaper(root_window_type); | 749 CreateSystemWallpaper(root_window_type); |
751 | 750 |
752 InitLayoutManagers(); | 751 InitLayoutManagers(); |
753 InitTouchHuds(); | 752 InitTouchHuds(); |
754 | 753 |
755 if (shell_port->GetPrimaryRootWindowController() | 754 if (Shell::GetPrimaryRootWindowController() |
756 ->GetSystemModalLayoutManager(nullptr) | 755 ->GetSystemModalLayoutManager(nullptr) |
757 ->has_window_dimmer()) { | 756 ->has_window_dimmer()) { |
758 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); | 757 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); |
759 } | 758 } |
760 | 759 |
761 shell->AddShellObserver(this); | 760 shell->AddShellObserver(this); |
762 | 761 |
763 root_window_layout_manager_->OnWindowResized(); | 762 root_window_layout_manager_->OnWindowResized(); |
764 if (root_window_type == RootWindowType::PRIMARY) { | 763 if (root_window_type == RootWindowType::PRIMARY) { |
765 if (Shell::GetAshConfig() != Config::MASH) | 764 if (Shell::GetAshConfig() != Config::MASH) |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 if (!touch_hud_projection_) | 1067 if (!touch_hud_projection_) |
1069 return; | 1068 return; |
1070 touch_hud_projection_->Remove(); | 1069 touch_hud_projection_->Remove(); |
1071 } | 1070 } |
1072 | 1071 |
1073 void RootWindowController::ResetRootForNewWindowsIfNecessary() { | 1072 void RootWindowController::ResetRootForNewWindowsIfNecessary() { |
1074 // Change the target root window before closing child windows. If any child | 1073 // Change the target root window before closing child windows. If any child |
1075 // being removed triggers a relayout of the shelf it will try to build a | 1074 // being removed triggers a relayout of the shelf it will try to build a |
1076 // window list adding windows from the target root window's containers which | 1075 // window list adding windows from the target root window's containers which |
1077 // may have already gone away. | 1076 // may have already gone away. |
1078 WmWindow* root = GetWindow(); | 1077 aura::Window* root = GetRootWindow(); |
1079 if (Shell::GetWmRootWindowForNewWindows() == root) { | 1078 if (Shell::GetRootWindowForNewWindows() == root) { |
1080 // The root window for new windows is being destroyed. Switch to the primary | 1079 // The root window for new windows is being destroyed. Switch to the primary |
1081 // root window if possible. | 1080 // root window if possible. |
1082 WmWindow* primary_root = ShellPort::Get()->GetPrimaryRootWindow(); | 1081 aura::Window* primary_root = Shell::GetPrimaryRootWindow(); |
1083 Shell::Get()->set_root_window_for_new_windows( | 1082 Shell::Get()->set_root_window_for_new_windows( |
1084 primary_root == root ? nullptr : primary_root); | 1083 primary_root == root ? nullptr : primary_root); |
1085 } | 1084 } |
1086 } | 1085 } |
1087 | 1086 |
1088 void RootWindowController::OnMenuClosed() { | 1087 void RootWindowController::OnMenuClosed() { |
1089 menu_runner_.reset(); | 1088 menu_runner_.reset(); |
1090 menu_model_adapter_.reset(); | 1089 menu_model_adapter_.reset(); |
1091 menu_model_.reset(); | 1090 menu_model_.reset(); |
1092 wm_shelf_->UpdateVisibilityState(); | 1091 wm_shelf_->UpdateVisibilityState(); |
1093 } | 1092 } |
1094 | 1093 |
1095 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1094 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
1096 if (enabled) | 1095 if (enabled) |
1097 EnableTouchHudProjection(); | 1096 EnableTouchHudProjection(); |
1098 else | 1097 else |
1099 DisableTouchHudProjection(); | 1098 DisableTouchHudProjection(); |
1100 } | 1099 } |
1101 | 1100 |
1102 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1101 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
1103 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1102 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
1104 } | 1103 } |
1105 | 1104 |
1106 } // namespace ash | 1105 } // namespace ash |
OLD | NEW |