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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 lock_modal_container->SetEventFilter( | 219 lock_modal_container->SetEventFilter( |
219 new ToplevelWindowEventFilter(lock_modal_container)); | 220 new ToplevelWindowEventFilter(lock_modal_container)); |
220 lock_modal_container->SetLayoutManager( | 221 lock_modal_container->SetLayoutManager( |
221 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 222 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
222 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 223 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
223 | 224 |
224 CreateContainer(internal::kShellWindowId_StatusContainer, | 225 CreateContainer(internal::kShellWindowId_StatusContainer, |
225 "StatusContainer", | 226 "StatusContainer", |
226 lock_screen_related_containers); | 227 lock_screen_related_containers); |
227 | 228 |
| 229 aura::Window* settings_bubble_container = CreateContainer( |
| 230 internal::kShellWindowId_SettingBubbleContainer, |
| 231 "SettingBubbleContainer", |
| 232 lock_screen_related_containers); |
| 233 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 234 |
228 aura::Window* menu_container = CreateContainer( | 235 aura::Window* menu_container = CreateContainer( |
229 internal::kShellWindowId_MenuContainer, | 236 internal::kShellWindowId_MenuContainer, |
230 "MenuContainer", | 237 "MenuContainer", |
231 lock_screen_related_containers); | 238 lock_screen_related_containers); |
232 SetChildWindowVisibilityChangesAnimated(menu_container); | 239 SetChildWindowVisibilityChangesAnimated(menu_container); |
233 | 240 |
234 aura::Window* drag_drop_container = CreateContainer( | 241 aura::Window* drag_drop_container = CreateContainer( |
235 internal::kShellWindowId_DragImageAndTooltipContainer, | 242 internal::kShellWindowId_DragImageAndTooltipContainer, |
236 "DragImageAndTooltipContainer", | 243 "DragImageAndTooltipContainer", |
237 lock_screen_related_containers); | 244 lock_screen_related_containers); |
238 SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 245 SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
239 | 246 |
240 aura::Window* settings_bubble_container = CreateContainer( | |
241 internal::kShellWindowId_SettingBubbleContainer, | |
242 "SettingBubbleContainer", | |
243 lock_screen_related_containers); | |
244 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | |
245 | |
246 CreateContainer(internal::kShellWindowId_OverlayContainer, | 247 CreateContainer(internal::kShellWindowId_OverlayContainer, |
247 "OverlayContainer", | 248 "OverlayContainer", |
248 lock_screen_related_containers); | 249 lock_screen_related_containers); |
249 } | 250 } |
250 | 251 |
251 // This dummy class is used for shell unit tests. We dont have chrome delegate | 252 // This dummy class is used for shell unit tests. We dont have chrome delegate |
252 // in these tests. | 253 // in these tests. |
253 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | 254 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { |
254 public: | 255 public: |
255 DummyUserWallpaperDelegate() {} | 256 DummyUserWallpaperDelegate() {} |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 // TooltipController is deleted with the Shell so removing its references. | 608 // TooltipController is deleted with the Shell so removing its references. |
608 RemoveEnvEventFilter(tooltip_controller_.get()); | 609 RemoveEnvEventFilter(tooltip_controller_.get()); |
609 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); | 610 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); |
610 | 611 |
611 // Make sure we delete WorkspaceController before launcher is | 612 // Make sure we delete WorkspaceController before launcher is |
612 // deleted as it has a reference to launcher model. | 613 // deleted as it has a reference to launcher model. |
613 workspace_controller_.reset(); | 614 workspace_controller_.reset(); |
614 | 615 |
615 // The system tray needs to be reset before all the windows are destroyed. | 616 // The system tray needs to be reset before all the windows are destroyed. |
616 system_tray_.reset(); | 617 system_tray_.reset(); |
| 618 web_notification_tray_.reset(); |
617 tray_delegate_.reset(); | 619 tray_delegate_.reset(); |
618 | 620 |
619 // Destroy secondary monitor's widgets before all the windows are destroyed. | 621 // Destroy secondary monitor's widgets before all the windows are destroyed. |
620 monitor_controller_.reset(); | 622 monitor_controller_.reset(); |
621 | 623 |
622 // Delete containers now so that child windows does not access | 624 // Delete containers now so that child windows does not access |
623 // observers when they are destructed. | 625 // observers when they are destructed. |
624 aura::RootWindow* root_window = GetPrimaryRootWindow(); | 626 aura::RootWindow* root_window = GetPrimaryRootWindow(); |
625 while (!root_window->children().empty()) { | 627 while (!root_window->children().empty()) { |
626 aura::Window* child = root_window->children()[0]; | 628 aura::Window* child = root_window->children()[0]; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 | 780 |
779 stacking_controller_.reset(new internal::StackingController); | 781 stacking_controller_.reset(new internal::StackingController); |
780 | 782 |
781 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 783 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
782 root_window->SetLayoutManager(root_window_layout_); | 784 root_window->SetLayoutManager(root_window_layout_); |
783 | 785 |
784 event_client_.reset(new internal::EventClientImpl(root_window)); | 786 event_client_.reset(new internal::EventClientImpl(root_window)); |
785 | 787 |
786 status_area_widget_ = new internal::StatusAreaWidget; | 788 status_area_widget_ = new internal::StatusAreaWidget; |
787 | 789 |
| 790 web_notification_tray_.reset(new WebNotificationTray()); |
| 791 status_area_widget_->AddTray(web_notification_tray_.get()); |
| 792 |
788 system_tray_.reset(new SystemTray()); | 793 system_tray_.reset(new SystemTray()); |
789 status_area_widget_->AddTray(system_tray_.get()); | 794 status_area_widget_->AddTray(system_tray_.get()); |
790 system_tray_->Initialize(); | 795 system_tray_->Initialize(); |
791 | 796 |
792 if (delegate_.get()) { | 797 if (delegate_.get()) { |
793 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( | 798 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( |
794 system_tray_.get())); | 799 system_tray_.get())); |
795 } | 800 } |
796 if (!tray_delegate_.get()) | 801 if (!tray_delegate_.get()) |
797 tray_delegate_.reset(new DummySystemTrayDelegate()); | 802 tray_delegate_.reset(new DummySystemTrayDelegate()); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 void Shell::SetCursor(gfx::NativeCursor cursor) { | 1081 void Shell::SetCursor(gfx::NativeCursor cursor) { |
1077 // TODO(oshima): set cursor to all root windows. | 1082 // TODO(oshima): set cursor to all root windows. |
1078 GetPrimaryRootWindow()->SetCursor(cursor); | 1083 GetPrimaryRootWindow()->SetCursor(cursor); |
1079 } | 1084 } |
1080 | 1085 |
1081 void Shell::ShowCursor(bool visible) { | 1086 void Shell::ShowCursor(bool visible) { |
1082 GetPrimaryRootWindow()->ShowCursor(visible); | 1087 GetPrimaryRootWindow()->ShowCursor(visible); |
1083 } | 1088 } |
1084 | 1089 |
1085 } // namespace ash | 1090 } // namespace ash |
OLD | NEW |