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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 GetRootWindowSettings(root_window)->controller = this; | 720 GetRootWindowSettings(root_window)->controller = this; |
721 | 721 |
722 stacking_controller_.reset(new StackingController); | 722 stacking_controller_.reset(new StackingController); |
723 aura::client::SetWindowParentingClient(root_window, | 723 aura::client::SetWindowParentingClient(root_window, |
724 stacking_controller_.get()); | 724 stacking_controller_.get()); |
725 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); | 725 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); |
726 } | 726 } |
727 | 727 |
728 void RootWindowController::Init(RootWindowType root_window_type) { | 728 void RootWindowController::Init(RootWindowType root_window_type) { |
729 aura::Window* root_window = GetRootWindow(); | 729 aura::Window* root_window = GetRootWindow(); |
730 ShellPort* shell_port = ShellPort::Get(); | |
731 Shell* shell = Shell::Get(); | 730 Shell* shell = Shell::Get(); |
732 shell->InitRootWindow(root_window); | 731 shell->InitRootWindow(root_window); |
733 | 732 |
734 CreateContainers(); | 733 CreateContainers(); |
735 ShellPort::Get()->OnCreatedRootWindowContainers(this); | 734 ShellPort::Get()->OnCreatedRootWindowContainers(this); |
736 | 735 |
737 CreateSystemWallpaper(root_window_type); | 736 CreateSystemWallpaper(root_window_type); |
738 | 737 |
739 InitLayoutManagers(); | 738 InitLayoutManagers(); |
740 InitTouchHuds(); | 739 InitTouchHuds(); |
741 | 740 |
742 if (shell_port->GetPrimaryRootWindowController() | 741 if (Shell::GetPrimaryRootWindowController() |
743 ->GetSystemModalLayoutManager(nullptr) | 742 ->GetSystemModalLayoutManager(nullptr) |
744 ->has_window_dimmer()) { | 743 ->has_window_dimmer()) { |
745 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); | 744 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); |
746 } | 745 } |
747 | 746 |
748 shell->AddShellObserver(this); | 747 shell->AddShellObserver(this); |
749 | 748 |
750 root_window_layout_manager_->OnWindowResized(); | 749 root_window_layout_manager_->OnWindowResized(); |
751 if (root_window_type == RootWindowType::PRIMARY) { | 750 if (root_window_type == RootWindowType::PRIMARY) { |
752 if (Shell::GetAshConfig() != Config::MASH) | 751 if (Shell::GetAshConfig() != Config::MASH) |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 if (!touch_hud_projection_) | 1054 if (!touch_hud_projection_) |
1056 return; | 1055 return; |
1057 touch_hud_projection_->Remove(); | 1056 touch_hud_projection_->Remove(); |
1058 } | 1057 } |
1059 | 1058 |
1060 void RootWindowController::ResetRootForNewWindowsIfNecessary() { | 1059 void RootWindowController::ResetRootForNewWindowsIfNecessary() { |
1061 // Change the target root window before closing child windows. If any child | 1060 // Change the target root window before closing child windows. If any child |
1062 // being removed triggers a relayout of the shelf it will try to build a | 1061 // being removed triggers a relayout of the shelf it will try to build a |
1063 // window list adding windows from the target root window's containers which | 1062 // window list adding windows from the target root window's containers which |
1064 // may have already gone away. | 1063 // may have already gone away. |
1065 WmWindow* root = GetWindow(); | 1064 aura::Window* root = GetRootWindow(); |
1066 if (Shell::GetWmRootWindowForNewWindows() == root) { | 1065 if (Shell::GetRootWindowForNewWindows() == root) { |
1067 // The root window for new windows is being destroyed. Switch to the primary | 1066 // The root window for new windows is being destroyed. Switch to the primary |
1068 // root window if possible. | 1067 // root window if possible. |
1069 WmWindow* primary_root = ShellPort::Get()->GetPrimaryRootWindow(); | 1068 aura::Window* primary_root = Shell::GetPrimaryRootWindow(); |
1070 Shell::Get()->set_root_window_for_new_windows( | 1069 Shell::Get()->set_root_window_for_new_windows( |
1071 primary_root == root ? nullptr : primary_root); | 1070 primary_root == root ? nullptr : primary_root); |
1072 } | 1071 } |
1073 } | 1072 } |
1074 | 1073 |
1075 void RootWindowController::OnMenuClosed() { | 1074 void RootWindowController::OnMenuClosed() { |
1076 menu_runner_.reset(); | 1075 menu_runner_.reset(); |
1077 menu_model_adapter_.reset(); | 1076 menu_model_adapter_.reset(); |
1078 menu_model_.reset(); | 1077 menu_model_.reset(); |
1079 wm_shelf_->UpdateVisibilityState(); | 1078 wm_shelf_->UpdateVisibilityState(); |
1080 } | 1079 } |
1081 | 1080 |
1082 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1081 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
1083 if (enabled) | 1082 if (enabled) |
1084 EnableTouchHudProjection(); | 1083 EnableTouchHudProjection(); |
1085 else | 1084 else |
1086 DisableTouchHudProjection(); | 1085 DisableTouchHudProjection(); |
1087 } | 1086 } |
1088 | 1087 |
1089 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1088 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
1090 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1089 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
1091 } | 1090 } |
1092 | 1091 |
1093 } // namespace ash | 1092 } // namespace ash |
OLD | NEW |