| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/accelerators/accelerator_controller.h" | 11 #include "ash/accelerators/accelerator_controller.h" |
| 12 #include "ash/accelerators/accelerator_delegate.h" | 12 #include "ash/accelerators/accelerator_delegate.h" |
| 13 #include "ash/accelerators/focus_manager_factory.h" | 13 #include "ash/accelerators/focus_manager_factory.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/aura/wm_shell_aura.h" |
| 16 #include "ash/aura/wm_window_aura.h" |
| 15 #include "ash/autoclick/autoclick_controller.h" | 17 #include "ash/autoclick/autoclick_controller.h" |
| 16 #include "ash/common/shell_window_ids.h" | 18 #include "ash/common/shell_window_ids.h" |
| 17 #include "ash/common/wm/root_window_finder.h" | 19 #include "ash/common/wm/root_window_finder.h" |
| 18 #include "ash/common/wm/window_positioner.h" | 20 #include "ash/common/wm/window_positioner.h" |
| 19 #include "ash/container_delegate.h" | 21 #include "ash/container_delegate.h" |
| 20 #include "ash/desktop_background/desktop_background_controller.h" | 22 #include "ash/desktop_background/desktop_background_controller.h" |
| 21 #include "ash/desktop_background/desktop_background_view.h" | 23 #include "ash/desktop_background/desktop_background_view.h" |
| 22 #include "ash/desktop_background/user_wallpaper_delegate.h" | 24 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 23 #include "ash/display/cursor_window_controller.h" | 25 #include "ash/display/cursor_window_controller.h" |
| 24 #include "ash/display/display_configuration_controller.h" | 26 #include "ash/display/display_configuration_controller.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "ash/shell_factory.h" | 58 #include "ash/shell_factory.h" |
| 57 #include "ash/shell_init_params.h" | 59 #include "ash/shell_init_params.h" |
| 58 #include "ash/system/locale/locale_notification_controller.h" | 60 #include "ash/system/locale/locale_notification_controller.h" |
| 59 #include "ash/system/status_area_widget.h" | 61 #include "ash/system/status_area_widget.h" |
| 60 #include "ash/system/toast/toast_manager.h" | 62 #include "ash/system/toast/toast_manager.h" |
| 61 #include "ash/system/tray/system_tray_delegate.h" | 63 #include "ash/system/tray/system_tray_delegate.h" |
| 62 #include "ash/system/tray/system_tray_notifier.h" | 64 #include "ash/system/tray/system_tray_notifier.h" |
| 63 #include "ash/utility/screenshot_controller.h" | 65 #include "ash/utility/screenshot_controller.h" |
| 64 #include "ash/wm/ash_focus_rules.h" | 66 #include "ash/wm/ash_focus_rules.h" |
| 65 #include "ash/wm/ash_native_cursor_manager.h" | 67 #include "ash/wm/ash_native_cursor_manager.h" |
| 66 #include "ash/wm/aura/wm_globals_aura.h" | |
| 67 #include "ash/wm/aura/wm_window_aura.h" | |
| 68 #include "ash/wm/event_client_impl.h" | 68 #include "ash/wm/event_client_impl.h" |
| 69 #include "ash/wm/lock_state_controller.h" | 69 #include "ash/wm/lock_state_controller.h" |
| 70 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 70 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 71 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | 71 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 72 #include "ash/wm/mru_window_tracker.h" | 72 #include "ash/wm/mru_window_tracker.h" |
| 73 #include "ash/wm/overlay_event_filter.h" | 73 #include "ash/wm/overlay_event_filter.h" |
| 74 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" | 74 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" |
| 75 #include "ash/wm/overview/window_selector_controller.h" | 75 #include "ash/wm/overview/window_selector_controller.h" |
| 76 #include "ash/wm/power_button_controller.h" | 76 #include "ash/wm/power_button_controller.h" |
| 77 #include "ash/wm/resize_shadow_controller.h" | 77 #include "ash/wm/resize_shadow_controller.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 void Shell::ShowContextMenu(const gfx::Point& location_in_screen, | 310 void Shell::ShowContextMenu(const gfx::Point& location_in_screen, |
| 311 ui::MenuSourceType source_type) { | 311 ui::MenuSourceType source_type) { |
| 312 // No context menus if there is no session with an active user. | 312 // No context menus if there is no session with an active user. |
| 313 if (!session_state_delegate_->NumberOfLoggedInUsers()) | 313 if (!session_state_delegate_->NumberOfLoggedInUsers()) |
| 314 return; | 314 return; |
| 315 // No context menus when screen is locked. | 315 // No context menus when screen is locked. |
| 316 if (session_state_delegate_->IsScreenLocked()) | 316 if (session_state_delegate_->IsScreenLocked()) |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 aura::Window* root = wm::WmWindowAura::GetAuraWindow( | 319 aura::Window* root = WmWindowAura::GetAuraWindow( |
| 320 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()))); | 320 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()))); |
| 321 GetRootWindowController(root) | 321 GetRootWindowController(root) |
| 322 ->ShowContextMenu(location_in_screen, source_type); | 322 ->ShowContextMenu(location_in_screen, source_type); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void Shell::ShowAppList(aura::Window* window) { | 325 void Shell::ShowAppList(aura::Window* window) { |
| 326 // If the context window is not given, show it on the target root window. | 326 // If the context window is not given, show it on the target root window. |
| 327 delegate_->GetAppListPresenter()->Show(GetDisplayIdForWindow(window)); | 327 delegate_->GetAppListPresenter()->Show(GetDisplayIdForWindow(window)); |
| 328 } | 328 } |
| 329 | 329 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 816 |
| 817 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 817 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
| 818 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since | 818 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since |
| 819 // destruction | 819 // destruction |
| 820 // of its owned RootWindowControllers relies on the value. | 820 // of its owned RootWindowControllers relies on the value. |
| 821 display_manager_->CreateScreenForShutdown(); | 821 display_manager_->CreateScreenForShutdown(); |
| 822 display_configuration_controller_.reset(); | 822 display_configuration_controller_.reset(); |
| 823 | 823 |
| 824 // Needs to happen before |window_tree_host_manager_|. Calls back to Shell, so | 824 // Needs to happen before |window_tree_host_manager_|. Calls back to Shell, so |
| 825 // also needs to be destroyed before |instance_| reset to null. | 825 // also needs to be destroyed before |instance_| reset to null. |
| 826 wm_globals_.reset(); | 826 wm_shell_.reset(); |
| 827 | 827 |
| 828 // Depends on |focus_client_|, so must be destroyed before. | 828 // Depends on |focus_client_|, so must be destroyed before. |
| 829 window_tree_host_manager_->Shutdown(); | 829 window_tree_host_manager_->Shutdown(); |
| 830 window_tree_host_manager_.reset(); | 830 window_tree_host_manager_.reset(); |
| 831 focus_client_.reset(); | 831 focus_client_.reset(); |
| 832 screen_position_controller_.reset(); | 832 screen_position_controller_.reset(); |
| 833 accessibility_delegate_.reset(); | 833 accessibility_delegate_.reset(); |
| 834 new_window_delegate_.reset(); | 834 new_window_delegate_.reset(); |
| 835 media_delegate_.reset(); | 835 media_delegate_.reset(); |
| 836 container_delegate_.reset(); | 836 container_delegate_.reset(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 860 instance_ = nullptr; | 860 instance_ = nullptr; |
| 861 } | 861 } |
| 862 | 862 |
| 863 void Shell::Init(const ShellInitParams& init_params) { | 863 void Shell::Init(const ShellInitParams& init_params) { |
| 864 in_mus_ = init_params.in_mus; | 864 in_mus_ = init_params.in_mus; |
| 865 | 865 |
| 866 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 866 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 867 DCHECK(in_mus_) << "linux desktop does not support ash."; | 867 DCHECK(in_mus_) << "linux desktop does not support ash."; |
| 868 #endif | 868 #endif |
| 869 | 869 |
| 870 wm_globals_.reset(new wm::WmGlobalsAura); | 870 wm_shell_.reset(new WmShellAura); |
| 871 scoped_overview_animation_settings_factory_.reset( | 871 scoped_overview_animation_settings_factory_.reset( |
| 872 new ScopedOverviewAnimationSettingsFactoryAura); | 872 new ScopedOverviewAnimationSettingsFactoryAura); |
| 873 window_positioner_.reset(new WindowPositioner(wm_globals_.get())); | 873 window_positioner_.reset(new WindowPositioner(wm_shell_.get())); |
| 874 | 874 |
| 875 if (!in_mus_) { | 875 if (!in_mus_) { |
| 876 native_cursor_manager_ = new AshNativeCursorManager; | 876 native_cursor_manager_ = new AshNativeCursorManager; |
| 877 #if defined(OS_CHROMEOS) | 877 #if defined(OS_CHROMEOS) |
| 878 cursor_manager_.reset( | 878 cursor_manager_.reset( |
| 879 new CursorManager(base::WrapUnique(native_cursor_manager_))); | 879 new CursorManager(base::WrapUnique(native_cursor_manager_))); |
| 880 #else | 880 #else |
| 881 cursor_manager_.reset( | 881 cursor_manager_.reset( |
| 882 new ::wm::CursorManager(base::WrapUnique(native_cursor_manager_))); | 882 new ::wm::CursorManager(base::WrapUnique(native_cursor_manager_))); |
| 883 #endif | 883 #endif |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 accelerator_filter_.reset(new ::wm::AcceleratorFilter( | 1004 accelerator_filter_.reset(new ::wm::AcceleratorFilter( |
| 1005 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), | 1005 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), |
| 1006 accelerator_controller_->accelerator_history())); | 1006 accelerator_controller_->accelerator_history())); |
| 1007 AddPreTargetHandler(accelerator_filter_.get()); | 1007 AddPreTargetHandler(accelerator_filter_.get()); |
| 1008 | 1008 |
| 1009 event_transformation_handler_.reset(new EventTransformationHandler); | 1009 event_transformation_handler_.reset(new EventTransformationHandler); |
| 1010 AddPreTargetHandler(event_transformation_handler_.get()); | 1010 AddPreTargetHandler(event_transformation_handler_.get()); |
| 1011 | 1011 |
| 1012 toplevel_window_event_handler_.reset( | 1012 toplevel_window_event_handler_.reset( |
| 1013 new ToplevelWindowEventHandler(wm_globals_.get())); | 1013 new ToplevelWindowEventHandler(wm_shell_.get())); |
| 1014 | 1014 |
| 1015 system_gesture_filter_.reset(new SystemGestureEventFilter); | 1015 system_gesture_filter_.reset(new SystemGestureEventFilter); |
| 1016 AddPreTargetHandler(system_gesture_filter_.get()); | 1016 AddPreTargetHandler(system_gesture_filter_.get()); |
| 1017 | 1017 |
| 1018 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); | 1018 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); |
| 1019 AddPreTargetHandler(keyboard_metrics_filter_.get()); | 1019 AddPreTargetHandler(keyboard_metrics_filter_.get()); |
| 1020 | 1020 |
| 1021 #if defined(OS_CHROMEOS) | 1021 #if defined(OS_CHROMEOS) |
| 1022 sticky_keys_controller_.reset(new StickyKeysController); | 1022 sticky_keys_controller_.reset(new StickyKeysController); |
| 1023 #endif | 1023 #endif |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1249 |
| 1250 void Shell::OnWindowActivated( | 1250 void Shell::OnWindowActivated( |
| 1251 aura::client::ActivationChangeObserver::ActivationReason reason, | 1251 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1252 aura::Window* gained_active, | 1252 aura::Window* gained_active, |
| 1253 aura::Window* lost_active) { | 1253 aura::Window* lost_active) { |
| 1254 if (gained_active) | 1254 if (gained_active) |
| 1255 target_root_window_ = gained_active->GetRootWindow(); | 1255 target_root_window_ = gained_active->GetRootWindow(); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 } // namespace ash | 1258 } // namespace ash |
| OLD | NEW |