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_dispatcher_controller.h" | 13 #include "ash/accelerators/nested_accelerator_delegate.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" |
111 #include "ui/wm/core/shadow_controller.h" | 112 #include "ui/wm/core/shadow_controller.h" |
112 #include "ui/wm/core/user_activity_detector.h" | 113 #include "ui/wm/core/user_activity_detector.h" |
113 #include "ui/wm/core/visibility_controller.h" | 114 #include "ui/wm/core/visibility_controller.h" |
114 #include "ui/wm/core/window_modality_controller.h" | 115 #include "ui/wm/core/window_modality_controller.h" |
115 | 116 |
116 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
117 #if defined(USE_X11) | 118 #if defined(USE_X11) |
118 #include "ash/accelerators/magnifier_key_scroller.h" | 119 #include "ash/accelerators/magnifier_key_scroller.h" |
119 #include "ash/accelerators/spoken_feedback_toggler.h" | 120 #include "ash/accelerators/spoken_feedback_toggler.h" |
120 #include "ash/touch/touch_transformer_controller.h" | 121 #include "ash/touch/touch_transformer_controller.h" |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // needs to remove observers from it. | 755 // needs to remove observers from it. |
755 system_tray_notifier_.reset(); | 756 system_tray_notifier_.reset(); |
756 | 757 |
757 // These need a valid Shell instance to clean up properly, so explicitly | 758 // These need a valid Shell instance to clean up properly, so explicitly |
758 // delete them before invalidating the instance. | 759 // delete them before invalidating the instance. |
759 // Alphabetical. TODO(oshima): sort. | 760 // Alphabetical. TODO(oshima): sort. |
760 magnification_controller_.reset(); | 761 magnification_controller_.reset(); |
761 partial_magnification_controller_.reset(); | 762 partial_magnification_controller_.reset(); |
762 tooltip_controller_.reset(); | 763 tooltip_controller_.reset(); |
763 event_client_.reset(); | 764 event_client_.reset(); |
764 nested_dispatcher_controller_.reset(); | 765 nested_accelerator_controller_.reset(); |
765 toplevel_window_event_handler_.reset(); | 766 toplevel_window_event_handler_.reset(); |
766 visibility_controller_.reset(); | 767 visibility_controller_.reset(); |
767 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be | 768 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
768 // destroyed before |shelf_model_| is destroyed. | 769 // destroyed before |shelf_model_| is destroyed. |
769 shelf_item_delegate_manager_.reset(); | 770 shelf_item_delegate_manager_.reset(); |
770 shelf_model_.reset(); | 771 shelf_model_.reset(); |
771 | 772 |
772 power_button_controller_.reset(); | 773 power_button_controller_.reset(); |
773 lock_state_controller_.reset(); | 774 lock_state_controller_.reset(); |
774 | 775 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); | 881 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); |
881 target_root_window_ = root_window; | 882 target_root_window_ = root_window; |
882 | 883 |
883 #if defined(OS_CHROMEOS) | 884 #if defined(OS_CHROMEOS) |
884 resolution_notification_controller_.reset( | 885 resolution_notification_controller_.reset( |
885 new ResolutionNotificationController); | 886 new ResolutionNotificationController); |
886 #endif | 887 #endif |
887 | 888 |
888 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); | 889 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
889 | 890 |
890 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 891 nested_accelerator_controller_.reset( |
| 892 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); |
891 accelerator_controller_.reset(new AcceleratorController); | 893 accelerator_controller_.reset(new AcceleratorController); |
892 maximize_mode_controller_.reset(new MaximizeModeController()); | 894 maximize_mode_controller_.reset(new MaximizeModeController()); |
893 | 895 |
894 #if defined(OS_CHROMEOS) && defined(USE_X11) | 896 #if defined(OS_CHROMEOS) && defined(USE_X11) |
895 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler().Pass(); | 897 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler().Pass(); |
896 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 898 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
897 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler().Pass(); | 899 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler().Pass(); |
898 AddPreTargetHandler(speech_feedback_handler_.get()); | 900 AddPreTargetHandler(speech_feedback_handler_.get()); |
899 #endif | 901 #endif |
900 | 902 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 screen_position_controller_.get()); | 1095 screen_position_controller_.get()); |
1094 aura::client::SetCursorClient(root_window, &cursor_manager_); | 1096 aura::client::SetCursorClient(root_window, &cursor_manager_); |
1095 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | 1097 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); |
1096 aura::client::SetEventClient(root_window, event_client_.get()); | 1098 aura::client::SetEventClient(root_window, event_client_.get()); |
1097 | 1099 |
1098 aura::client::SetWindowMoveClient(root_window, | 1100 aura::client::SetWindowMoveClient(root_window, |
1099 toplevel_window_event_handler_.get()); | 1101 toplevel_window_event_handler_.get()); |
1100 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1102 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
1101 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1103 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
1102 | 1104 |
1103 if (nested_dispatcher_controller_) { | 1105 if (nested_accelerator_controller_) { |
1104 aura::client::SetDispatcherClient(root_window, | 1106 aura::client::SetDispatcherClient(root_window, |
1105 nested_dispatcher_controller_.get()); | 1107 nested_accelerator_controller_.get()); |
1106 } | 1108 } |
1107 } | 1109 } |
1108 | 1110 |
1109 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1111 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
1110 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1112 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1111 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1113 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1112 iter != controllers.end(); ++iter) { | 1114 iter != controllers.end(); ++iter) { |
1113 SystemModalContainerLayoutManager* layout_manager = | 1115 SystemModalContainerLayoutManager* layout_manager = |
1114 (*iter)->GetSystemModalLayoutManager(window); | 1116 (*iter)->GetSystemModalLayoutManager(window); |
1115 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) | 1117 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 //////////////////////////////////////////////////////////////////////////////// | 1151 //////////////////////////////////////////////////////////////////////////////// |
1150 // Shell, aura::client::ActivationChangeObserver implementation: | 1152 // Shell, aura::client::ActivationChangeObserver implementation: |
1151 | 1153 |
1152 void Shell::OnWindowActivated(aura::Window* gained_active, | 1154 void Shell::OnWindowActivated(aura::Window* gained_active, |
1153 aura::Window* lost_active) { | 1155 aura::Window* lost_active) { |
1154 if (gained_active) | 1156 if (gained_active) |
1155 target_root_window_ = gained_active->GetRootWindow(); | 1157 target_root_window_ = gained_active->GetRootWindow(); |
1156 } | 1158 } |
1157 | 1159 |
1158 } // namespace ash | 1160 } // namespace ash |
OLD | NEW |