| 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/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_commands.h" | 7 #include "ash/common/accelerators/accelerator_commands.h" |
| 8 #include "ash/common/accelerators/accelerator_controller_delegate.h" | 8 #include "ash/common/accelerators/accelerator_controller_delegate.h" |
| 9 #include "ash/common/accelerators/debug_commands.h" | 9 #include "ash/common/accelerators/debug_commands.h" |
| 10 #include "ash/common/accessibility_delegate.h" | 10 #include "ash/common/accessibility_delegate.h" |
| 11 #include "ash/common/accessibility_types.h" | 11 #include "ash/common/accessibility_types.h" |
| 12 #include "ash/common/focus_cycler.h" | 12 #include "ash/common/focus_cycler.h" |
| 13 #include "ash/common/ime_control_delegate.h" | 13 #include "ash/common/ime_control_delegate.h" |
| 14 #include "ash/common/media_delegate.h" | 14 #include "ash/common/media_delegate.h" |
| 15 #include "ash/common/multi_profile_uma.h" | 15 #include "ash/common/multi_profile_uma.h" |
| 16 #include "ash/common/new_window_delegate.h" | 16 #include "ash/common/new_window_delegate.h" |
| 17 #include "ash/common/session/session_state_delegate.h" | 17 #include "ash/common/session/session_state_delegate.h" |
| 18 #include "ash/common/shelf/shelf_widget.h" | 18 #include "ash/common/shelf/shelf_widget.h" |
| 19 #include "ash/common/shelf/wm_shelf.h" | 19 #include "ash/common/shelf/wm_shelf.h" |
| 20 #include "ash/common/shell_delegate.h" | 20 #include "ash/common/shell_delegate.h" |
| 21 #include "ash/common/system/brightness_control_delegate.h" | 21 #include "ash/common/system/brightness_control_delegate.h" |
| 22 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 22 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
| 23 #include "ash/common/system/status_area_widget.h" | 23 #include "ash/common/system/status_area_widget.h" |
| 24 #include "ash/common/system/tray/system_tray_delegate.h" | 24 #include "ash/common/system/tray/system_tray_delegate.h" |
| 25 #include "ash/common/system/tray/system_tray_notifier.h" | 25 #include "ash/common/system/tray/system_tray_notifier.h" |
| 26 #include "ash/common/system/volume_control_delegate.h" | 26 #include "ash/common/system/volume_control_delegate.h" |
| 27 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 27 #include "ash/common/wm/mru_window_tracker.h" | 28 #include "ash/common/wm/mru_window_tracker.h" |
| 28 #include "ash/common/wm/overview/window_selector_controller.h" | 29 #include "ash/common/wm/overview/window_selector_controller.h" |
| 29 #include "ash/common/wm/window_cycle_controller.h" | 30 #include "ash/common/wm/window_cycle_controller.h" |
| 30 #include "ash/common/wm/window_positioning_utils.h" | 31 #include "ash/common/wm/window_positioning_utils.h" |
| 31 #include "ash/common/wm/window_state.h" | 32 #include "ash/common/wm/window_state.h" |
| 32 #include "ash/common/wm/wm_event.h" | 33 #include "ash/common/wm/wm_event.h" |
| 33 #include "ash/common/wm_root_window_controller.h" | 34 #include "ash/common/wm_root_window_controller.h" |
| 34 #include "ash/common/wm_shell.h" | 35 #include "ash/common/wm_shell.h" |
| 35 #include "ash/common/wm_window.h" | 36 #include "ash/common/wm_window.h" |
| 36 #include "base/metrics/histogram_macros.h" | 37 #include "base/metrics/histogram_macros.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 void HandleRestoreTab() { | 215 void HandleRestoreTab() { |
| 215 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); | 216 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); |
| 216 WmShell::Get()->new_window_delegate()->RestoreTab(); | 217 WmShell::Get()->new_window_delegate()->RestoreTab(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void HandleShowKeyboardOverlay() { | 220 void HandleShowKeyboardOverlay() { |
| 220 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); | 221 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| 221 WmShell::Get()->new_window_delegate()->ShowKeyboardOverlay(); | 222 WmShell::Get()->new_window_delegate()->ShowKeyboardOverlay(); |
| 222 } | 223 } |
| 223 | 224 |
| 225 bool CanHandleShowMessageCenterBubble() { |
| 226 WmWindow* target_root = WmShell::Get()->GetRootWindowForNewWindows(); |
| 227 StatusAreaWidget* status_area_widget = |
| 228 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 229 return status_area_widget && |
| 230 status_area_widget->web_notification_tray()->visible(); |
| 231 } |
| 232 |
| 233 void HandleShowMessageCenterBubble() { |
| 234 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); |
| 235 WmWindow* target_root = WmShell::Get()->GetRootWindowForNewWindows(); |
| 236 StatusAreaWidget* status_area_widget = |
| 237 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 238 if (status_area_widget) { |
| 239 WebNotificationTray* notification_tray = |
| 240 status_area_widget->web_notification_tray(); |
| 241 if (notification_tray->visible()) |
| 242 notification_tray->ShowMessageCenterBubble(); |
| 243 } |
| 244 } |
| 245 |
| 224 void HandleShowTaskManager() { | 246 void HandleShowTaskManager() { |
| 225 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager")); | 247 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager")); |
| 226 WmShell::Get()->new_window_delegate()->ShowTaskManager(); | 248 WmShell::Get()->new_window_delegate()->ShowTaskManager(); |
| 227 } | 249 } |
| 228 | 250 |
| 229 bool CanHandleSwitchIme(ImeControlDelegate* ime_control_delegate, | 251 bool CanHandleSwitchIme(ImeControlDelegate* ime_control_delegate, |
| 230 const ui::Accelerator& accelerator) { | 252 const ui::Accelerator& accelerator) { |
| 231 return ime_control_delegate && | 253 return ime_control_delegate && |
| 232 ime_control_delegate->CanSwitchIme(accelerator); | 254 ime_control_delegate->CanSwitchIme(accelerator); |
| 233 } | 255 } |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 case DEBUG_PRINT_LAYER_HIERARCHY: | 744 case DEBUG_PRINT_LAYER_HIERARCHY: |
| 723 case DEBUG_PRINT_VIEW_HIERARCHY: | 745 case DEBUG_PRINT_VIEW_HIERARCHY: |
| 724 case DEBUG_PRINT_WINDOW_HIERARCHY: | 746 case DEBUG_PRINT_WINDOW_HIERARCHY: |
| 725 return debug::DebugAcceleratorsEnabled(); | 747 return debug::DebugAcceleratorsEnabled(); |
| 726 case NEW_INCOGNITO_WINDOW: | 748 case NEW_INCOGNITO_WINDOW: |
| 727 return CanHandleNewIncognitoWindow(); | 749 return CanHandleNewIncognitoWindow(); |
| 728 case NEXT_IME: | 750 case NEXT_IME: |
| 729 return CanHandleNextIme(ime_control_delegate_.get()); | 751 return CanHandleNextIme(ime_control_delegate_.get()); |
| 730 case PREVIOUS_IME: | 752 case PREVIOUS_IME: |
| 731 return CanHandlePreviousIme(ime_control_delegate_.get()); | 753 return CanHandlePreviousIme(ime_control_delegate_.get()); |
| 754 case SHOW_MESSAGE_CENTER_BUBBLE: |
| 755 return CanHandleShowMessageCenterBubble(); |
| 732 case SWITCH_IME: | 756 case SWITCH_IME: |
| 733 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); | 757 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); |
| 734 case TOGGLE_APP_LIST: | 758 case TOGGLE_APP_LIST: |
| 735 return CanHandleToggleAppList(accelerator, previous_accelerator); | 759 return CanHandleToggleAppList(accelerator, previous_accelerator); |
| 736 case WINDOW_CYCLE_SNAP_DOCK_LEFT: | 760 case WINDOW_CYCLE_SNAP_DOCK_LEFT: |
| 737 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: | 761 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: |
| 738 return CanHandleWindowSnapOrDock(); | 762 return CanHandleWindowSnapOrDock(); |
| 739 case WINDOW_POSITION_CENTER: | 763 case WINDOW_POSITION_CENTER: |
| 740 return CanHandlePositionCenter(); | 764 return CanHandlePositionCenter(); |
| 741 #if defined(OS_CHROMEOS) | 765 #if defined(OS_CHROMEOS) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 break; | 927 break; |
| 904 case PRINT_UI_HIERARCHIES: | 928 case PRINT_UI_HIERARCHIES: |
| 905 debug::PrintUIHierarchies(); | 929 debug::PrintUIHierarchies(); |
| 906 break; | 930 break; |
| 907 case RESTORE_TAB: | 931 case RESTORE_TAB: |
| 908 HandleRestoreTab(); | 932 HandleRestoreTab(); |
| 909 break; | 933 break; |
| 910 case SHOW_KEYBOARD_OVERLAY: | 934 case SHOW_KEYBOARD_OVERLAY: |
| 911 HandleShowKeyboardOverlay(); | 935 HandleShowKeyboardOverlay(); |
| 912 break; | 936 break; |
| 937 case SHOW_MESSAGE_CENTER_BUBBLE: |
| 938 HandleShowMessageCenterBubble(); |
| 939 break; |
| 913 case SHOW_TASK_MANAGER: | 940 case SHOW_TASK_MANAGER: |
| 914 HandleShowTaskManager(); | 941 HandleShowTaskManager(); |
| 915 break; | 942 break; |
| 916 case SWITCH_IME: | 943 case SWITCH_IME: |
| 917 HandleSwitchIme(ime_control_delegate_.get(), accelerator); | 944 HandleSwitchIme(ime_control_delegate_.get(), accelerator); |
| 918 break; | 945 break; |
| 919 case TOGGLE_APP_LIST: | 946 case TOGGLE_APP_LIST: |
| 920 HandleToggleAppList(accelerator); | 947 HandleToggleAppList(accelerator); |
| 921 break; | 948 break; |
| 922 case TOGGLE_FULLSCREEN: | 949 case TOGGLE_FULLSCREEN: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && | 1103 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && |
| 1077 actions_needing_window_.find(action) != actions_needing_window_.end()) { | 1104 actions_needing_window_.find(action) != actions_needing_window_.end()) { |
| 1078 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( | 1105 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( |
| 1079 A11Y_ALERT_WINDOW_NEEDED); | 1106 A11Y_ALERT_WINDOW_NEEDED); |
| 1080 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1107 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1081 } | 1108 } |
| 1082 return RESTRICTION_NONE; | 1109 return RESTRICTION_NONE; |
| 1083 } | 1110 } |
| 1084 | 1111 |
| 1085 } // namespace ash | 1112 } // namespace ash |
| OLD | NEW |