| 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/accelerators/nested_accelerator_delegate.h" | |
| 15 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 16 #include "ash/autoclick/autoclick_controller.h" | 15 #include "ash/autoclick/autoclick_controller.h" |
| 17 #include "ash/desktop_background/desktop_background_controller.h" | 16 #include "ash/desktop_background/desktop_background_controller.h" |
| 18 #include "ash/desktop_background/desktop_background_view.h" | 17 #include "ash/desktop_background/desktop_background_view.h" |
| 19 #include "ash/desktop_background/user_wallpaper_delegate.h" | 18 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 20 #include "ash/display/cursor_window_controller.h" | 19 #include "ash/display/cursor_window_controller.h" |
| 21 #include "ash/display/display_configuration_controller.h" | 20 #include "ash/display/display_configuration_controller.h" |
| 22 #include "ash/display/display_manager.h" | 21 #include "ash/display/display_manager.h" |
| 23 #include "ash/display/event_transformation_handler.h" | 22 #include "ash/display/event_transformation_handler.h" |
| 24 #include "ash/display/mouse_cursor_event_filter.h" | 23 #include "ash/display/mouse_cursor_event_filter.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 #include "ui/keyboard/keyboard_util.h" | 101 #include "ui/keyboard/keyboard_util.h" |
| 103 #include "ui/message_center/message_center.h" | 102 #include "ui/message_center/message_center.h" |
| 104 #include "ui/views/corewm/tooltip_aura.h" | 103 #include "ui/views/corewm/tooltip_aura.h" |
| 105 #include "ui/views/corewm/tooltip_controller.h" | 104 #include "ui/views/corewm/tooltip_controller.h" |
| 106 #include "ui/views/focus/focus_manager_factory.h" | 105 #include "ui/views/focus/focus_manager_factory.h" |
| 107 #include "ui/views/widget/native_widget_aura.h" | 106 #include "ui/views/widget/native_widget_aura.h" |
| 108 #include "ui/views/widget/widget.h" | 107 #include "ui/views/widget/widget.h" |
| 109 #include "ui/wm/core/accelerator_filter.h" | 108 #include "ui/wm/core/accelerator_filter.h" |
| 110 #include "ui/wm/core/compound_event_filter.h" | 109 #include "ui/wm/core/compound_event_filter.h" |
| 111 #include "ui/wm/core/focus_controller.h" | 110 #include "ui/wm/core/focus_controller.h" |
| 112 #include "ui/wm/core/nested_accelerator_controller.h" | |
| 113 #include "ui/wm/core/shadow_controller.h" | 111 #include "ui/wm/core/shadow_controller.h" |
| 114 #include "ui/wm/core/visibility_controller.h" | 112 #include "ui/wm/core/visibility_controller.h" |
| 115 #include "ui/wm/core/window_modality_controller.h" | 113 #include "ui/wm/core/window_modality_controller.h" |
| 116 | 114 |
| 117 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
| 118 #if defined(USE_X11) | 116 #if defined(USE_X11) |
| 119 #include "ui/gfx/x/x11_types.h" | 117 #include "ui/gfx/x/x11_types.h" |
| 120 #endif // defined(USE_X11) | 118 #endif // defined(USE_X11) |
| 121 #include "ash/accelerators/magnifier_key_scroller.h" | 119 #include "ash/accelerators/magnifier_key_scroller.h" |
| 122 #include "ash/accelerators/spoken_feedback_toggler.h" | 120 #include "ash/accelerators/spoken_feedback_toggler.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 // needs to remove observers from it. | 775 // needs to remove observers from it. |
| 778 system_tray_notifier_.reset(); | 776 system_tray_notifier_.reset(); |
| 779 | 777 |
| 780 // These need a valid Shell instance to clean up properly, so explicitly | 778 // These need a valid Shell instance to clean up properly, so explicitly |
| 781 // delete them before invalidating the instance. | 779 // delete them before invalidating the instance. |
| 782 // Alphabetical. TODO(oshima): sort. | 780 // Alphabetical. TODO(oshima): sort. |
| 783 magnification_controller_.reset(); | 781 magnification_controller_.reset(); |
| 784 partial_magnification_controller_.reset(); | 782 partial_magnification_controller_.reset(); |
| 785 tooltip_controller_.reset(); | 783 tooltip_controller_.reset(); |
| 786 event_client_.reset(); | 784 event_client_.reset(); |
| 787 nested_accelerator_controller_.reset(); | |
| 788 toplevel_window_event_handler_.reset(); | 785 toplevel_window_event_handler_.reset(); |
| 789 visibility_controller_.reset(); | 786 visibility_controller_.reset(); |
| 790 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be | 787 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
| 791 // destroyed before |shelf_model_| is destroyed. | 788 // destroyed before |shelf_model_| is destroyed. |
| 792 shelf_item_delegate_manager_.reset(); | 789 shelf_item_delegate_manager_.reset(); |
| 793 shelf_model_.reset(); | 790 shelf_model_.reset(); |
| 794 | 791 |
| 795 power_button_controller_.reset(); | 792 power_button_controller_.reset(); |
| 796 lock_state_controller_.reset(); | 793 lock_state_controller_.reset(); |
| 797 | 794 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow(); | 912 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow(); |
| 916 target_root_window_ = root_window; | 913 target_root_window_ = root_window; |
| 917 | 914 |
| 918 #if defined(OS_CHROMEOS) | 915 #if defined(OS_CHROMEOS) |
| 919 resolution_notification_controller_.reset( | 916 resolution_notification_controller_.reset( |
| 920 new ResolutionNotificationController); | 917 new ResolutionNotificationController); |
| 921 #endif | 918 #endif |
| 922 | 919 |
| 923 cursor_manager_.SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); | 920 cursor_manager_.SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); |
| 924 | 921 |
| 925 nested_accelerator_controller_.reset( | |
| 926 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); | |
| 927 accelerator_controller_.reset(new AcceleratorController); | 922 accelerator_controller_.reset(new AcceleratorController); |
| 928 maximize_mode_controller_.reset(new MaximizeModeController()); | 923 maximize_mode_controller_.reset(new MaximizeModeController()); |
| 929 | 924 |
| 930 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); | 925 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); |
| 931 | 926 |
| 932 #if defined(OS_CHROMEOS) | 927 #if defined(OS_CHROMEOS) |
| 933 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 928 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
| 934 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 929 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
| 935 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); | 930 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); |
| 936 AddPreTargetHandler(speech_feedback_handler_.get()); | 931 AddPreTargetHandler(speech_feedback_handler_.get()); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 aura::client::SetScreenPositionClient(root_window, | 1119 aura::client::SetScreenPositionClient(root_window, |
| 1125 screen_position_controller_.get()); | 1120 screen_position_controller_.get()); |
| 1126 aura::client::SetCursorClient(root_window, &cursor_manager_); | 1121 aura::client::SetCursorClient(root_window, &cursor_manager_); |
| 1127 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | 1122 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); |
| 1128 aura::client::SetEventClient(root_window, event_client_.get()); | 1123 aura::client::SetEventClient(root_window, event_client_.get()); |
| 1129 | 1124 |
| 1130 aura::client::SetWindowMoveClient(root_window, | 1125 aura::client::SetWindowMoveClient(root_window, |
| 1131 toplevel_window_event_handler_.get()); | 1126 toplevel_window_event_handler_.get()); |
| 1132 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1127 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
| 1133 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1128 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
| 1134 | |
| 1135 if (nested_accelerator_controller_) { | |
| 1136 aura::client::SetDispatcherClient(root_window, | |
| 1137 nested_accelerator_controller_.get()); | |
| 1138 } | |
| 1139 } | 1129 } |
| 1140 | 1130 |
| 1141 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1131 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
| 1142 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1132 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 1143 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1133 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 1144 iter != controllers.end(); ++iter) { | 1134 iter != controllers.end(); ++iter) { |
| 1145 SystemModalContainerLayoutManager* layout_manager = | 1135 SystemModalContainerLayoutManager* layout_manager = |
| 1146 (*iter)->GetSystemModalLayoutManager(window); | 1136 (*iter)->GetSystemModalLayoutManager(window); |
| 1147 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) | 1137 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) |
| 1148 return true; | 1138 return true; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1170 |
| 1181 void Shell::OnWindowActivated( | 1171 void Shell::OnWindowActivated( |
| 1182 aura::client::ActivationChangeObserver::ActivationReason reason, | 1172 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1183 aura::Window* gained_active, | 1173 aura::Window* gained_active, |
| 1184 aura::Window* lost_active) { | 1174 aura::Window* lost_active) { |
| 1185 if (gained_active) | 1175 if (gained_active) |
| 1186 target_root_window_ = gained_active->GetRootWindow(); | 1176 target_root_window_ = gained_active->GetRootWindow(); |
| 1187 } | 1177 } |
| 1188 | 1178 |
| 1189 } // namespace ash | 1179 } // namespace ash |
| OLD | NEW |