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_delegate.h" | 11 #include "ash/accelerators/accelerator_delegate.h" |
| 12 #include "ash/accelerators/ash_menu_event_filter_delegate.h" |
12 #include "ash/accelerators/focus_manager_factory.h" | 13 #include "ash/accelerators/focus_manager_factory.h" |
13 #include "ash/accelerators/nested_accelerator_delegate.h" | 14 #include "ash/accelerators/nested_accelerator_delegate.h" |
14 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
15 #include "ash/autoclick/autoclick_controller.h" | 16 #include "ash/autoclick/autoclick_controller.h" |
16 #include "ash/desktop_background/desktop_background_controller.h" | 17 #include "ash/desktop_background/desktop_background_controller.h" |
17 #include "ash/desktop_background/desktop_background_view.h" | 18 #include "ash/desktop_background/desktop_background_view.h" |
18 #include "ash/desktop_background/user_wallpaper_delegate.h" | 19 #include "ash/desktop_background/user_wallpaper_delegate.h" |
19 #include "ash/display/cursor_window_controller.h" | 20 #include "ash/display/cursor_window_controller.h" |
20 #include "ash/display/display_controller.h" | 21 #include "ash/display/display_controller.h" |
21 #include "ash/display/display_manager.h" | 22 #include "ash/display/display_manager.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #include "ui/events/event_target_iterator.h" | 94 #include "ui/events/event_target_iterator.h" |
94 #include "ui/gfx/display.h" | 95 #include "ui/gfx/display.h" |
95 #include "ui/gfx/geometry/size.h" | 96 #include "ui/gfx/geometry/size.h" |
96 #include "ui/gfx/image/image_skia.h" | 97 #include "ui/gfx/image/image_skia.h" |
97 #include "ui/gfx/screen.h" | 98 #include "ui/gfx/screen.h" |
98 #include "ui/keyboard/keyboard.h" | 99 #include "ui/keyboard/keyboard.h" |
99 #include "ui/keyboard/keyboard_controller.h" | 100 #include "ui/keyboard/keyboard_controller.h" |
100 #include "ui/keyboard/keyboard_switches.h" | 101 #include "ui/keyboard/keyboard_switches.h" |
101 #include "ui/keyboard/keyboard_util.h" | 102 #include "ui/keyboard/keyboard_util.h" |
102 #include "ui/message_center/message_center.h" | 103 #include "ui/message_center/message_center.h" |
| 104 #include "ui/views/controls/menu/menu_event_filter.h" |
103 #include "ui/views/corewm/tooltip_aura.h" | 105 #include "ui/views/corewm/tooltip_aura.h" |
104 #include "ui/views/corewm/tooltip_controller.h" | 106 #include "ui/views/corewm/tooltip_controller.h" |
105 #include "ui/views/focus/focus_manager_factory.h" | 107 #include "ui/views/focus/focus_manager_factory.h" |
106 #include "ui/views/widget/native_widget_aura.h" | 108 #include "ui/views/widget/native_widget_aura.h" |
107 #include "ui/views/widget/widget.h" | 109 #include "ui/views/widget/widget.h" |
108 #include "ui/wm/core/accelerator_filter.h" | 110 #include "ui/wm/core/accelerator_filter.h" |
109 #include "ui/wm/core/compound_event_filter.h" | 111 #include "ui/wm/core/compound_event_filter.h" |
110 #include "ui/wm/core/focus_controller.h" | 112 #include "ui/wm/core/focus_controller.h" |
111 #include "ui/wm/core/nested_accelerator_controller.h" | 113 #include "ui/wm/core/nested_accelerator_controller.h" |
112 #include "ui/wm/core/shadow_controller.h" | 114 #include "ui/wm/core/shadow_controller.h" |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 #if defined(OS_CHROMEOS) | 911 #if defined(OS_CHROMEOS) |
910 resolution_notification_controller_.reset( | 912 resolution_notification_controller_.reset( |
911 new ResolutionNotificationController); | 913 new ResolutionNotificationController); |
912 #endif | 914 #endif |
913 | 915 |
914 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); | 916 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
915 | 917 |
916 nested_accelerator_controller_.reset( | 918 nested_accelerator_controller_.reset( |
917 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); | 919 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); |
918 accelerator_controller_.reset(new AcceleratorController); | 920 accelerator_controller_.reset(new AcceleratorController); |
| 921 |
| 922 menu_event_filter_delegate_.reset(new AshMenuEventFilterDelegate( |
| 923 accelerator_controller_->accelerator_history())); |
| 924 |
919 maximize_mode_controller_.reset(new MaximizeModeController()); | 925 maximize_mode_controller_.reset(new MaximizeModeController()); |
920 | 926 |
921 #if defined(OS_CHROMEOS) | 927 #if defined(OS_CHROMEOS) |
922 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 928 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
923 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 929 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
924 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); | 930 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); |
925 AddPreTargetHandler(speech_feedback_handler_.get()); | 931 AddPreTargetHandler(speech_feedback_handler_.get()); |
926 #endif | 932 #endif |
927 | 933 |
928 // The order in which event filters are added is significant. | 934 // The order in which event filters are added is significant. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 | 1128 |
1123 aura::client::SetWindowMoveClient(root_window, | 1129 aura::client::SetWindowMoveClient(root_window, |
1124 toplevel_window_event_handler_.get()); | 1130 toplevel_window_event_handler_.get()); |
1125 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1131 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
1126 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1132 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
1127 | 1133 |
1128 if (nested_accelerator_controller_) { | 1134 if (nested_accelerator_controller_) { |
1129 aura::client::SetDispatcherClient(root_window, | 1135 aura::client::SetDispatcherClient(root_window, |
1130 nested_accelerator_controller_.get()); | 1136 nested_accelerator_controller_.get()); |
1131 } | 1137 } |
| 1138 |
| 1139 views::MenuEventFilter::SetMenuEventFilterDelegate( |
| 1140 root_window, menu_event_filter_delegate_.get()); |
1132 } | 1141 } |
1133 | 1142 |
1134 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1143 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
1135 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1144 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1136 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1145 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1137 iter != controllers.end(); ++iter) { | 1146 iter != controllers.end(); ++iter) { |
1138 SystemModalContainerLayoutManager* layout_manager = | 1147 SystemModalContainerLayoutManager* layout_manager = |
1139 (*iter)->GetSystemModalLayoutManager(window); | 1148 (*iter)->GetSystemModalLayoutManager(window); |
1140 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) | 1149 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) |
1141 return true; | 1150 return true; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 | 1185 |
1177 void Shell::OnWindowActivated( | 1186 void Shell::OnWindowActivated( |
1178 aura::client::ActivationChangeObserver::ActivationReason reason, | 1187 aura::client::ActivationChangeObserver::ActivationReason reason, |
1179 aura::Window* gained_active, | 1188 aura::Window* gained_active, |
1180 aura::Window* lost_active) { | 1189 aura::Window* lost_active) { |
1181 if (gained_active) | 1190 if (gained_active) |
1182 target_root_window_ = gained_active->GetRootWindow(); | 1191 target_root_window_ = gained_active->GetRootWindow(); |
1183 } | 1192 } |
1184 | 1193 |
1185 } // namespace ash | 1194 } // namespace ash |
OLD | NEW |