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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
11 #include "ash/accelerators/accelerator_filter.h" | 11 #include "ash/accelerators/accelerator_filter.h" |
12 #include "ash/accelerators/focus_manager_factory.h" | 12 #include "ash/accelerators/focus_manager_factory.h" |
13 #include "ash/accelerators/nested_accelerator_delegate.h" | 13 #include "ash/accelerators/nested_dispatcher_controller.h" |
14 #include "ash/accelerometer/accelerometer_controller.h" | 14 #include "ash/accelerometer/accelerometer_controller.h" |
15 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
16 #include "ash/autoclick/autoclick_controller.h" | 16 #include "ash/autoclick/autoclick_controller.h" |
17 #include "ash/desktop_background/desktop_background_controller.h" | 17 #include "ash/desktop_background/desktop_background_controller.h" |
18 #include "ash/desktop_background/desktop_background_view.h" | 18 #include "ash/desktop_background/desktop_background_view.h" |
19 #include "ash/desktop_background/user_wallpaper_delegate.h" | 19 #include "ash/desktop_background/user_wallpaper_delegate.h" |
20 #include "ash/display/cursor_window_controller.h" | 20 #include "ash/display/cursor_window_controller.h" |
21 #include "ash/display/display_controller.h" | 21 #include "ash/display/display_controller.h" |
22 #include "ash/display/display_manager.h" | 22 #include "ash/display/display_manager.h" |
23 #include "ash/display/event_transformation_handler.h" | 23 #include "ash/display/event_transformation_handler.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include "ui/keyboard/keyboard_util.h" | 101 #include "ui/keyboard/keyboard_util.h" |
102 #include "ui/message_center/message_center.h" | 102 #include "ui/message_center/message_center.h" |
103 #include "ui/views/corewm/tooltip_aura.h" | 103 #include "ui/views/corewm/tooltip_aura.h" |
104 #include "ui/views/corewm/tooltip_controller.h" | 104 #include "ui/views/corewm/tooltip_controller.h" |
105 #include "ui/views/focus/focus_manager_factory.h" | 105 #include "ui/views/focus/focus_manager_factory.h" |
106 #include "ui/views/widget/native_widget_aura.h" | 106 #include "ui/views/widget/native_widget_aura.h" |
107 #include "ui/views/widget/widget.h" | 107 #include "ui/views/widget/widget.h" |
108 #include "ui/wm/core/compound_event_filter.h" | 108 #include "ui/wm/core/compound_event_filter.h" |
109 #include "ui/wm/core/focus_controller.h" | 109 #include "ui/wm/core/focus_controller.h" |
110 #include "ui/wm/core/input_method_event_filter.h" | 110 #include "ui/wm/core/input_method_event_filter.h" |
111 #include "ui/wm/core/nested_accelerator_controller.h" | |
112 #include "ui/wm/core/shadow_controller.h" | 111 #include "ui/wm/core/shadow_controller.h" |
113 #include "ui/wm/core/user_activity_detector.h" | 112 #include "ui/wm/core/user_activity_detector.h" |
114 #include "ui/wm/core/visibility_controller.h" | 113 #include "ui/wm/core/visibility_controller.h" |
115 #include "ui/wm/core/window_modality_controller.h" | 114 #include "ui/wm/core/window_modality_controller.h" |
116 | 115 |
117 #if defined(OS_CHROMEOS) | 116 #if defined(OS_CHROMEOS) |
118 #if defined(USE_X11) | 117 #if defined(USE_X11) |
119 #include "ash/accelerators/magnifier_key_scroller.h" | 118 #include "ash/accelerators/magnifier_key_scroller.h" |
120 #include "ash/accelerators/spoken_feedback_toggler.h" | 119 #include "ash/accelerators/spoken_feedback_toggler.h" |
121 #include "ash/touch/touch_transformer_controller.h" | 120 #include "ash/touch/touch_transformer_controller.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // needs to remove observers from it. | 746 // needs to remove observers from it. |
748 system_tray_notifier_.reset(); | 747 system_tray_notifier_.reset(); |
749 | 748 |
750 // These need a valid Shell instance to clean up properly, so explicitly | 749 // These need a valid Shell instance to clean up properly, so explicitly |
751 // delete them before invalidating the instance. | 750 // delete them before invalidating the instance. |
752 // Alphabetical. TODO(oshima): sort. | 751 // Alphabetical. TODO(oshima): sort. |
753 magnification_controller_.reset(); | 752 magnification_controller_.reset(); |
754 partial_magnification_controller_.reset(); | 753 partial_magnification_controller_.reset(); |
755 tooltip_controller_.reset(); | 754 tooltip_controller_.reset(); |
756 event_client_.reset(); | 755 event_client_.reset(); |
757 nested_accelerator_controller_.reset(); | 756 nested_dispatcher_controller_.reset(); |
758 toplevel_window_event_handler_.reset(); | 757 toplevel_window_event_handler_.reset(); |
759 visibility_controller_.reset(); | 758 visibility_controller_.reset(); |
760 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be | 759 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
761 // destroyed before |shelf_model_| is destroyed. | 760 // destroyed before |shelf_model_| is destroyed. |
762 shelf_item_delegate_manager_.reset(); | 761 shelf_item_delegate_manager_.reset(); |
763 shelf_model_.reset(); | 762 shelf_model_.reset(); |
764 | 763 |
765 power_button_controller_.reset(); | 764 power_button_controller_.reset(); |
766 lock_state_controller_.reset(); | 765 lock_state_controller_.reset(); |
767 | 766 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); | 872 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); |
874 target_root_window_ = root_window; | 873 target_root_window_ = root_window; |
875 | 874 |
876 #if defined(OS_CHROMEOS) | 875 #if defined(OS_CHROMEOS) |
877 resolution_notification_controller_.reset( | 876 resolution_notification_controller_.reset( |
878 new ResolutionNotificationController); | 877 new ResolutionNotificationController); |
879 #endif | 878 #endif |
880 | 879 |
881 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); | 880 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
882 | 881 |
883 nested_accelerator_controller_.reset( | 882 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
884 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); | |
885 accelerator_controller_.reset(new AcceleratorController); | 883 accelerator_controller_.reset(new AcceleratorController); |
886 maximize_mode_controller_.reset(new MaximizeModeController()); | 884 maximize_mode_controller_.reset(new MaximizeModeController()); |
887 | 885 |
888 #if defined(OS_CHROMEOS) && defined(USE_X11) | 886 #if defined(OS_CHROMEOS) && defined(USE_X11) |
889 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler().Pass(); | 887 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler().Pass(); |
890 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 888 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
891 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler().Pass(); | 889 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler().Pass(); |
892 AddPreTargetHandler(speech_feedback_handler_.get()); | 890 AddPreTargetHandler(speech_feedback_handler_.get()); |
893 #endif | 891 #endif |
894 | 892 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 screen_position_controller_.get()); | 1085 screen_position_controller_.get()); |
1088 aura::client::SetCursorClient(root_window, &cursor_manager_); | 1086 aura::client::SetCursorClient(root_window, &cursor_manager_); |
1089 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | 1087 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); |
1090 aura::client::SetEventClient(root_window, event_client_.get()); | 1088 aura::client::SetEventClient(root_window, event_client_.get()); |
1091 | 1089 |
1092 aura::client::SetWindowMoveClient(root_window, | 1090 aura::client::SetWindowMoveClient(root_window, |
1093 toplevel_window_event_handler_.get()); | 1091 toplevel_window_event_handler_.get()); |
1094 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1092 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
1095 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1093 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
1096 | 1094 |
1097 if (nested_accelerator_controller_) { | 1095 if (nested_dispatcher_controller_) { |
1098 aura::client::SetDispatcherClient(root_window, | 1096 aura::client::SetDispatcherClient(root_window, |
1099 nested_accelerator_controller_.get()); | 1097 nested_dispatcher_controller_.get()); |
1100 } | 1098 } |
1101 } | 1099 } |
1102 | 1100 |
1103 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1101 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
1104 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1102 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1105 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1103 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1106 iter != controllers.end(); ++iter) { | 1104 iter != controllers.end(); ++iter) { |
1107 SystemModalContainerLayoutManager* layout_manager = | 1105 SystemModalContainerLayoutManager* layout_manager = |
1108 (*iter)->GetSystemModalLayoutManager(window); | 1106 (*iter)->GetSystemModalLayoutManager(window); |
1109 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) | 1107 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 //////////////////////////////////////////////////////////////////////////////// | 1141 //////////////////////////////////////////////////////////////////////////////// |
1144 // Shell, aura::client::ActivationChangeObserver implementation: | 1142 // Shell, aura::client::ActivationChangeObserver implementation: |
1145 | 1143 |
1146 void Shell::OnWindowActivated(aura::Window* gained_active, | 1144 void Shell::OnWindowActivated(aura::Window* gained_active, |
1147 aura::Window* lost_active) { | 1145 aura::Window* lost_active) { |
1148 if (gained_active) | 1146 if (gained_active) |
1149 target_root_window_ = gained_active->GetRootWindow(); | 1147 target_root_window_ = gained_active->GetRootWindow(); |
1150 } | 1148 } |
1151 | 1149 |
1152 } // namespace ash | 1150 } // namespace ash |
OLD | NEW |