| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 "AlwaysOnTopContainer", | 166 "AlwaysOnTopContainer", |
| 167 non_lock_screen_containers); | 167 non_lock_screen_containers); |
| 168 always_on_top_container->SetEventFilter( | 168 always_on_top_container->SetEventFilter( |
| 169 new ToplevelWindowEventFilter(always_on_top_container)); | 169 new ToplevelWindowEventFilter(always_on_top_container)); |
| 170 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 170 SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
| 171 | 171 |
| 172 CreateContainer(internal::kShellWindowId_PanelContainer, | 172 CreateContainer(internal::kShellWindowId_PanelContainer, |
| 173 "PanelContainer", | 173 "PanelContainer", |
| 174 non_lock_screen_containers); | 174 non_lock_screen_containers); |
| 175 | 175 |
| 176 // V1 Applist container is below launcher container. | |
| 177 bool use_v2_applist = internal::AppListController::UseAppListV2(); | |
| 178 if (!use_v2_applist) { | |
| 179 CreateContainer(internal::kShellWindowId_AppListContainer, | |
| 180 "AppListContainer", | |
| 181 non_lock_screen_containers); | |
| 182 } | |
| 183 | |
| 184 CreateContainer(internal::kShellWindowId_LauncherContainer, | 176 CreateContainer(internal::kShellWindowId_LauncherContainer, |
| 185 "LauncherContainer", | 177 "LauncherContainer", |
| 186 non_lock_screen_containers); | 178 non_lock_screen_containers); |
| 187 | 179 |
| 188 // V2 Applist container is above launcher container. | 180 CreateContainer(internal::kShellWindowId_AppListContainer, |
| 189 if (use_v2_applist) { | 181 "AppListContainer", |
| 190 CreateContainer(internal::kShellWindowId_AppListContainer, | 182 non_lock_screen_containers); |
| 191 "AppListContainer", | |
| 192 non_lock_screen_containers); | |
| 193 } | |
| 194 | 183 |
| 195 aura::Window* modal_container = CreateContainer( | 184 aura::Window* modal_container = CreateContainer( |
| 196 internal::kShellWindowId_SystemModalContainer, | 185 internal::kShellWindowId_SystemModalContainer, |
| 197 "SystemModalContainer", | 186 "SystemModalContainer", |
| 198 non_lock_screen_containers); | 187 non_lock_screen_containers); |
| 199 modal_container->SetEventFilter( | 188 modal_container->SetEventFilter( |
| 200 new ToplevelWindowEventFilter(modal_container)); | 189 new ToplevelWindowEventFilter(modal_container)); |
| 201 modal_container->SetLayoutManager( | 190 modal_container->SetLayoutManager( |
| 202 new internal::SystemModalContainerLayoutManager(modal_container)); | 191 new internal::SystemModalContainerLayoutManager(modal_container)); |
| 203 SetChildWindowVisibilityChangesAnimated(modal_container); | 192 SetChildWindowVisibilityChangesAnimated(modal_container); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); | 600 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); |
| 612 | 601 |
| 613 // Make sure we delete WorkspaceController before launcher is | 602 // Make sure we delete WorkspaceController before launcher is |
| 614 // deleted as it has a reference to launcher model. | 603 // deleted as it has a reference to launcher model. |
| 615 workspace_controller_.reset(); | 604 workspace_controller_.reset(); |
| 616 | 605 |
| 617 // The system tray needs to be reset before all the windows are destroyed. | 606 // The system tray needs to be reset before all the windows are destroyed. |
| 618 system_tray_.reset(); | 607 system_tray_.reset(); |
| 619 tray_delegate_.reset(); | 608 tray_delegate_.reset(); |
| 620 | 609 |
| 610 // AppList needs to be released before shelf layout manager, which is |
| 611 // destroyed with launcher container in the loop below. However, app list |
| 612 // container is now on top of launcher container and released after it. |
| 613 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 614 app_list_controller_.reset(); |
| 615 |
| 621 // Destroy secondary monitor's widgets before all the windows are destroyed. | 616 // Destroy secondary monitor's widgets before all the windows are destroyed. |
| 622 monitor_controller_.reset(); | 617 monitor_controller_.reset(); |
| 623 | 618 |
| 624 // Delete containers now so that child windows does not access | 619 // Delete containers now so that child windows does not access |
| 625 // observers when they are destructed. | 620 // observers when they are destructed. |
| 626 aura::RootWindow* root_window = GetPrimaryRootWindow(); | 621 aura::RootWindow* root_window = GetPrimaryRootWindow(); |
| 627 while (!root_window->children().empty()) { | 622 while (!root_window->children().empty()) { |
| 628 aura::Window* child = root_window->children()[0]; | 623 aura::Window* child = root_window->children()[0]; |
| 629 delete child; | 624 delete child; |
| 630 } | 625 } |
| 631 | 626 |
| 632 // These need a valid Shell instance to clean up properly, so explicitly | 627 // These need a valid Shell instance to clean up properly, so explicitly |
| 633 // delete them before invalidating the instance. | 628 // delete them before invalidating the instance. |
| 634 // Alphabetical. | 629 // Alphabetical. |
| 635 app_list_controller_.reset(); | |
| 636 drag_drop_controller_.reset(); | 630 drag_drop_controller_.reset(); |
| 637 event_client_.reset(); | 631 event_client_.reset(); |
| 638 magnification_controller_.reset(); | 632 magnification_controller_.reset(); |
| 639 monitor_controller_.reset(); | 633 monitor_controller_.reset(); |
| 640 power_button_controller_.reset(); | 634 power_button_controller_.reset(); |
| 641 resize_shadow_controller_.reset(); | 635 resize_shadow_controller_.reset(); |
| 642 screen_dimmer_.reset(); | 636 screen_dimmer_.reset(); |
| 643 shadow_controller_.reset(); | 637 shadow_controller_.reset(); |
| 644 tooltip_controller_.reset(); | 638 tooltip_controller_.reset(); |
| 645 window_cycle_controller_.reset(); | 639 window_cycle_controller_.reset(); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 void Shell::SetCursor(gfx::NativeCursor cursor) { | 1073 void Shell::SetCursor(gfx::NativeCursor cursor) { |
| 1080 // TODO(oshima): set cursor to all root windows. | 1074 // TODO(oshima): set cursor to all root windows. |
| 1081 GetPrimaryRootWindow()->SetCursor(cursor); | 1075 GetPrimaryRootWindow()->SetCursor(cursor); |
| 1082 } | 1076 } |
| 1083 | 1077 |
| 1084 void Shell::ShowCursor(bool visible) { | 1078 void Shell::ShowCursor(bool visible) { |
| 1085 GetPrimaryRootWindow()->ShowCursor(visible); | 1079 GetPrimaryRootWindow()->ShowCursor(visible); |
| 1086 } | 1080 } |
| 1087 | 1081 |
| 1088 } // namespace ash | 1082 } // namespace ash |
| OLD | NEW |