| 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 12 matching lines...) Expand all Loading... |
| 23 #include "ash/screen_ash.h" | 23 #include "ash/screen_ash.h" |
| 24 #include "ash/shell_context_menu.h" | 24 #include "ash/shell_context_menu.h" |
| 25 #include "ash/shell_delegate.h" | 25 #include "ash/shell_delegate.h" |
| 26 #include "ash/shell_factory.h" | 26 #include "ash/shell_factory.h" |
| 27 #include "ash/shell_window_ids.h" | 27 #include "ash/shell_window_ids.h" |
| 28 #include "ash/system/bluetooth/bluetooth_observer.h" | 28 #include "ash/system/bluetooth/bluetooth_observer.h" |
| 29 #include "ash/system/network/network_observer.h" | 29 #include "ash/system/network/network_observer.h" |
| 30 #include "ash/system/status_area_widget.h" | 30 #include "ash/system/status_area_widget.h" |
| 31 #include "ash/system/tray/system_tray.h" | 31 #include "ash/system/tray/system_tray.h" |
| 32 #include "ash/system/tray/system_tray_delegate.h" | 32 #include "ash/system/tray/system_tray_delegate.h" |
| 33 #include "ash/system/web_notification/web_notification_tray.h" |
| 33 #include "ash/tooltips/tooltip_controller.h" | 34 #include "ash/tooltips/tooltip_controller.h" |
| 34 #include "ash/touch/touch_observer_hud.h" | 35 #include "ash/touch/touch_observer_hud.h" |
| 35 #include "ash/wm/activation_controller.h" | 36 #include "ash/wm/activation_controller.h" |
| 36 #include "ash/wm/app_list_controller.h" | 37 #include "ash/wm/app_list_controller.h" |
| 37 #include "ash/wm/base_layout_manager.h" | 38 #include "ash/wm/base_layout_manager.h" |
| 38 #include "ash/wm/custom_frame_view_ash.h" | 39 #include "ash/wm/custom_frame_view_ash.h" |
| 39 #include "ash/wm/dialog_frame_view.h" | 40 #include "ash/wm/dialog_frame_view.h" |
| 40 #include "ash/wm/event_client_impl.h" | 41 #include "ash/wm/event_client_impl.h" |
| 41 #include "ash/wm/key_rewriter_event_filter.h" | 42 #include "ash/wm/key_rewriter_event_filter.h" |
| 42 #include "ash/wm/panel_layout_manager.h" | 43 #include "ash/wm/panel_layout_manager.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 lock_modal_container->SetEventFilter( | 207 lock_modal_container->SetEventFilter( |
| 207 new ToplevelWindowEventFilter(lock_modal_container)); | 208 new ToplevelWindowEventFilter(lock_modal_container)); |
| 208 lock_modal_container->SetLayoutManager( | 209 lock_modal_container->SetLayoutManager( |
| 209 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 210 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
| 210 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 211 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| 211 | 212 |
| 212 CreateContainer(internal::kShellWindowId_StatusContainer, | 213 CreateContainer(internal::kShellWindowId_StatusContainer, |
| 213 "StatusContainer", | 214 "StatusContainer", |
| 214 lock_screen_related_containers); | 215 lock_screen_related_containers); |
| 215 | 216 |
| 217 aura::Window* settings_bubble_container = CreateContainer( |
| 218 internal::kShellWindowId_SettingBubbleContainer, |
| 219 "SettingBubbleContainer", |
| 220 lock_screen_related_containers); |
| 221 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 222 |
| 216 aura::Window* menu_container = CreateContainer( | 223 aura::Window* menu_container = CreateContainer( |
| 217 internal::kShellWindowId_MenuContainer, | 224 internal::kShellWindowId_MenuContainer, |
| 218 "MenuContainer", | 225 "MenuContainer", |
| 219 lock_screen_related_containers); | 226 lock_screen_related_containers); |
| 220 SetChildWindowVisibilityChangesAnimated(menu_container); | 227 SetChildWindowVisibilityChangesAnimated(menu_container); |
| 221 | 228 |
| 222 aura::Window* drag_drop_container = CreateContainer( | 229 aura::Window* drag_drop_container = CreateContainer( |
| 223 internal::kShellWindowId_DragImageAndTooltipContainer, | 230 internal::kShellWindowId_DragImageAndTooltipContainer, |
| 224 "DragImageAndTooltipContainer", | 231 "DragImageAndTooltipContainer", |
| 225 lock_screen_related_containers); | 232 lock_screen_related_containers); |
| 226 SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 233 SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
| 227 | 234 |
| 228 aura::Window* settings_bubble_container = CreateContainer( | |
| 229 internal::kShellWindowId_SettingBubbleContainer, | |
| 230 "SettingBubbleContainer", | |
| 231 lock_screen_related_containers); | |
| 232 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | |
| 233 | |
| 234 CreateContainer(internal::kShellWindowId_OverlayContainer, | 235 CreateContainer(internal::kShellWindowId_OverlayContainer, |
| 235 "OverlayContainer", | 236 "OverlayContainer", |
| 236 lock_screen_related_containers); | 237 lock_screen_related_containers); |
| 237 } | 238 } |
| 238 | 239 |
| 239 // This dummy class is used for shell unit tests. We dont have chrome delegate | 240 // This dummy class is used for shell unit tests. We dont have chrome delegate |
| 240 // in these tests. | 241 // in these tests. |
| 241 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | 242 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { |
| 242 public: | 243 public: |
| 243 DummyUserWallpaperDelegate() {} | 244 DummyUserWallpaperDelegate() {} |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // TooltipController is deleted with the Shell so removing its references. | 594 // TooltipController is deleted with the Shell so removing its references. |
| 594 RemoveRootWindowEventFilter(tooltip_controller_.get()); | 595 RemoveRootWindowEventFilter(tooltip_controller_.get()); |
| 595 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); | 596 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); |
| 596 | 597 |
| 597 // Make sure we delete WorkspaceController before launcher is | 598 // Make sure we delete WorkspaceController before launcher is |
| 598 // deleted as it has a reference to launcher model. | 599 // deleted as it has a reference to launcher model. |
| 599 workspace_controller_.reset(); | 600 workspace_controller_.reset(); |
| 600 | 601 |
| 601 // The system tray needs to be reset before all the windows are destroyed. | 602 // The system tray needs to be reset before all the windows are destroyed. |
| 602 system_tray_.reset(); | 603 system_tray_.reset(); |
| 604 web_notification_tray_.reset(); |
| 603 tray_delegate_.reset(); | 605 tray_delegate_.reset(); |
| 604 | 606 |
| 605 // Destroy secondary monitor's widgets before all the windows are destroyed. | 607 // Destroy secondary monitor's widgets before all the windows are destroyed. |
| 606 monitor_controller_.reset(); | 608 monitor_controller_.reset(); |
| 607 | 609 |
| 608 // Delete containers now so that child windows does not access | 610 // Delete containers now so that child windows does not access |
| 609 // observers when they are destructed. | 611 // observers when they are destructed. |
| 610 aura::RootWindow* root_window = GetPrimaryRootWindow(); | 612 aura::RootWindow* root_window = GetPrimaryRootWindow(); |
| 611 while (!root_window->children().empty()) { | 613 while (!root_window->children().empty()) { |
| 612 aura::Window* child = root_window->children()[0]; | 614 aura::Window* child = root_window->children()[0]; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 755 |
| 754 stacking_controller_.reset(new internal::StackingController); | 756 stacking_controller_.reset(new internal::StackingController); |
| 755 | 757 |
| 756 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 758 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 757 root_window->SetLayoutManager(root_window_layout_); | 759 root_window->SetLayoutManager(root_window_layout_); |
| 758 | 760 |
| 759 event_client_.reset(new internal::EventClientImpl(root_window)); | 761 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 760 | 762 |
| 761 status_area_widget_ = new internal::StatusAreaWidget; | 763 status_area_widget_ = new internal::StatusAreaWidget; |
| 762 | 764 |
| 765 web_notification_tray_.reset(new WebNotificationTray()); |
| 766 status_area_widget_->AddTray(web_notification_tray_.get()); |
| 767 |
| 763 system_tray_.reset(new SystemTray()); | 768 system_tray_.reset(new SystemTray()); |
| 764 status_area_widget_->AddTray(system_tray_.get()); | 769 status_area_widget_->AddTray(system_tray_.get()); |
| 765 system_tray_->Initialize(); | 770 system_tray_->Initialize(); |
| 766 | 771 |
| 767 if (delegate_.get()) { | 772 if (delegate_.get()) { |
| 768 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( | 773 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( |
| 769 system_tray_.get())); | 774 system_tray_.get())); |
| 770 } | 775 } |
| 771 if (!tray_delegate_.get()) | 776 if (!tray_delegate_.get()) |
| 772 tray_delegate_.reset(new DummySystemTrayDelegate()); | 777 tray_delegate_.reset(new DummySystemTrayDelegate()); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 panel_container->SetLayoutManager(panel_layout_manager_); | 1050 panel_container->SetLayoutManager(panel_layout_manager_); |
| 1046 } | 1051 } |
| 1047 } | 1052 } |
| 1048 | 1053 |
| 1049 void Shell::DisableWorkspaceGridLayout() { | 1054 void Shell::DisableWorkspaceGridLayout() { |
| 1050 if (workspace_controller_.get()) | 1055 if (workspace_controller_.get()) |
| 1051 workspace_controller_->workspace_manager()->set_grid_size(0); | 1056 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 1052 } | 1057 } |
| 1053 | 1058 |
| 1054 } // namespace ash | 1059 } // namespace ash |
| OLD | NEW |