Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: ash/shell.cc

Issue 1138523006: Enable keyboard accelerators while a menu is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_manager.h" 21 #include "ash/display/display_manager.h"
21 #include "ash/display/event_transformation_handler.h" 22 #include "ash/display/event_transformation_handler.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 #include "ui/events/event_target_iterator.h" 95 #include "ui/events/event_target_iterator.h"
95 #include "ui/gfx/display.h" 96 #include "ui/gfx/display.h"
96 #include "ui/gfx/geometry/size.h" 97 #include "ui/gfx/geometry/size.h"
97 #include "ui/gfx/image/image_skia.h" 98 #include "ui/gfx/image/image_skia.h"
98 #include "ui/gfx/screen.h" 99 #include "ui/gfx/screen.h"
99 #include "ui/keyboard/keyboard.h" 100 #include "ui/keyboard/keyboard.h"
100 #include "ui/keyboard/keyboard_controller.h" 101 #include "ui/keyboard/keyboard_controller.h"
101 #include "ui/keyboard/keyboard_switches.h" 102 #include "ui/keyboard/keyboard_switches.h"
102 #include "ui/keyboard/keyboard_util.h" 103 #include "ui/keyboard/keyboard_util.h"
103 #include "ui/message_center/message_center.h" 104 #include "ui/message_center/message_center.h"
105 #include "ui/views/controls/menu/menu_event_filter.h"
104 #include "ui/views/corewm/tooltip_aura.h" 106 #include "ui/views/corewm/tooltip_aura.h"
105 #include "ui/views/corewm/tooltip_controller.h" 107 #include "ui/views/corewm/tooltip_controller.h"
106 #include "ui/views/focus/focus_manager_factory.h" 108 #include "ui/views/focus/focus_manager_factory.h"
107 #include "ui/views/widget/native_widget_aura.h" 109 #include "ui/views/widget/native_widget_aura.h"
108 #include "ui/views/widget/widget.h" 110 #include "ui/views/widget/widget.h"
109 #include "ui/wm/core/accelerator_filter.h" 111 #include "ui/wm/core/accelerator_filter.h"
110 #include "ui/wm/core/compound_event_filter.h" 112 #include "ui/wm/core/compound_event_filter.h"
111 #include "ui/wm/core/focus_controller.h" 113 #include "ui/wm/core/focus_controller.h"
112 #include "ui/wm/core/nested_accelerator_controller.h" 114 #include "ui/wm/core/nested_accelerator_controller.h"
113 #include "ui/wm/core/shadow_controller.h" 115 #include "ui/wm/core/shadow_controller.h"
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 #if defined(OS_CHROMEOS) 915 #if defined(OS_CHROMEOS)
914 resolution_notification_controller_.reset( 916 resolution_notification_controller_.reset(
915 new ResolutionNotificationController); 917 new ResolutionNotificationController);
916 #endif 918 #endif
917 919
918 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); 920 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay());
919 921
920 nested_accelerator_controller_.reset( 922 nested_accelerator_controller_.reset(
921 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); 923 new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate));
922 accelerator_controller_.reset(new AcceleratorController); 924 accelerator_controller_.reset(new AcceleratorController);
925
926 menu_event_filter_delegate_.reset(new AshMenuEventFilterDelegate);
oshima 2015/09/02 17:08:21 can you reset this in reverse order?
afakhry 2015/09/02 18:18:38 I used this order since AshMenuEventFilterDelegate
927
923 maximize_mode_controller_.reset(new MaximizeModeController()); 928 maximize_mode_controller_.reset(new MaximizeModeController());
924 929
925 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler()); 930 AddPreTargetHandler(window_tree_host_manager_->input_method_event_handler());
926 931
927 #if defined(OS_CHROMEOS) 932 #if defined(OS_CHROMEOS)
928 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); 933 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler();
929 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); 934 AddPreTargetHandler(magnifier_key_scroll_handler_.get());
930 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); 935 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler();
931 AddPreTargetHandler(speech_feedback_handler_.get()); 936 AddPreTargetHandler(speech_feedback_handler_.get());
932 #endif 937 #endif
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1134
1130 aura::client::SetWindowMoveClient(root_window, 1135 aura::client::SetWindowMoveClient(root_window,
1131 toplevel_window_event_handler_.get()); 1136 toplevel_window_event_handler_.get());
1132 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); 1137 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get());
1133 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); 1138 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get());
1134 1139
1135 if (nested_accelerator_controller_) { 1140 if (nested_accelerator_controller_) {
1136 aura::client::SetDispatcherClient(root_window, 1141 aura::client::SetDispatcherClient(root_window,
1137 nested_accelerator_controller_.get()); 1142 nested_accelerator_controller_.get());
1138 } 1143 }
1144
1145 views::MenuEventFilter::SetMenuEventFilterDelegate(
1146 root_window, menu_event_filter_delegate_.get());
1139 } 1147 }
1140 1148
1141 bool Shell::CanWindowReceiveEvents(aura::Window* window) { 1149 bool Shell::CanWindowReceiveEvents(aura::Window* window) {
1142 RootWindowControllerList controllers = GetAllRootWindowControllers(); 1150 RootWindowControllerList controllers = GetAllRootWindowControllers();
1143 for (RootWindowControllerList::iterator iter = controllers.begin(); 1151 for (RootWindowControllerList::iterator iter = controllers.begin();
1144 iter != controllers.end(); ++iter) { 1152 iter != controllers.end(); ++iter) {
1145 SystemModalContainerLayoutManager* layout_manager = 1153 SystemModalContainerLayoutManager* layout_manager =
1146 (*iter)->GetSystemModalLayoutManager(window); 1154 (*iter)->GetSystemModalLayoutManager(window);
1147 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) 1155 if (layout_manager && layout_manager->CanWindowReceiveEvents(window))
1148 return true; 1156 return true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1191
1184 void Shell::OnWindowActivated( 1192 void Shell::OnWindowActivated(
1185 aura::client::ActivationChangeObserver::ActivationReason reason, 1193 aura::client::ActivationChangeObserver::ActivationReason reason,
1186 aura::Window* gained_active, 1194 aura::Window* gained_active,
1187 aura::Window* lost_active) { 1195 aura::Window* lost_active) {
1188 if (gained_active) 1196 if (gained_active)
1189 target_root_window_ = gained_active->GetRootWindow(); 1197 target_root_window_ = gained_active->GetRootWindow();
1190 } 1198 }
1191 1199
1192 } // namespace ash 1200 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698