| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_commands.h" | 9 #include "ash/common/accelerators/accelerator_commands.h" |
| 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" | 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "ash/common/wm/mru_window_tracker.h" | 35 #include "ash/common/wm/mru_window_tracker.h" |
| 36 #include "ash/common/wm/overview/window_selector_controller.h" | 36 #include "ash/common/wm/overview/window_selector_controller.h" |
| 37 #include "ash/common/wm/window_cycle_controller.h" | 37 #include "ash/common/wm/window_cycle_controller.h" |
| 38 #include "ash/common/wm/window_positioning_utils.h" | 38 #include "ash/common/wm/window_positioning_utils.h" |
| 39 #include "ash/common/wm/window_state.h" | 39 #include "ash/common/wm/window_state.h" |
| 40 #include "ash/common/wm/wm_event.h" | 40 #include "ash/common/wm/wm_event.h" |
| 41 #include "ash/common/wm_shell.h" | 41 #include "ash/common/wm_shell.h" |
| 42 #include "ash/common/wm_window.h" | 42 #include "ash/common/wm_window.h" |
| 43 #include "ash/resources/vector_icons/vector_icons.h" | 43 #include "ash/resources/vector_icons/vector_icons.h" |
| 44 #include "ash/root_window_controller.h" | 44 #include "ash/root_window_controller.h" |
| 45 #include "ash/rotator/window_rotation.h" |
| 45 #include "ash/shell.h" | 46 #include "ash/shell.h" |
| 46 #include "ash/strings/grit/ash_strings.h" | 47 #include "ash/strings/grit/ash_strings.h" |
| 48 #include "ash/wm/window_util.h" |
| 47 #include "base/metrics/histogram_macros.h" | 49 #include "base/metrics/histogram_macros.h" |
| 48 #include "base/metrics/user_metrics.h" | 50 #include "base/metrics/user_metrics.h" |
| 49 #include "base/strings/string_split.h" | 51 #include "base/strings/string_split.h" |
| 50 #include "base/strings/utf_string_conversions.h" | 52 #include "base/strings/utf_string_conversions.h" |
| 51 #include "chromeos/dbus/dbus_thread_manager.h" | 53 #include "chromeos/dbus/dbus_thread_manager.h" |
| 52 #include "chromeos/dbus/power_manager_client.h" | 54 #include "chromeos/dbus/power_manager_client.h" |
| 53 #include "ui/base/accelerators/accelerator.h" | 55 #include "ui/base/accelerators/accelerator.h" |
| 54 #include "ui/base/accelerators/accelerator_manager.h" | 56 #include "ui/base/accelerators/accelerator_manager.h" |
| 55 #include "ui/base/ime/chromeos/ime_keyboard.h" | 57 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 56 #include "ui/base/ime/chromeos/input_method_manager.h" | 58 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 57 #include "ui/base/l10n/l10n_util.h" | 59 #include "ui/base/l10n/l10n_util.h" |
| 60 #include "ui/compositor/layer.h" |
| 61 #include "ui/compositor/layer_animation_sequence.h" |
| 62 #include "ui/compositor/layer_animator.h" |
| 58 #include "ui/gfx/paint_vector_icon.h" | 63 #include "ui/gfx/paint_vector_icon.h" |
| 59 #include "ui/keyboard/keyboard_controller.h" | 64 #include "ui/keyboard/keyboard_controller.h" |
| 60 #include "ui/message_center/message_center.h" | 65 #include "ui/message_center/message_center.h" |
| 61 | 66 |
| 62 namespace ash { | 67 namespace ash { |
| 63 namespace { | 68 namespace { |
| 64 | 69 |
| 65 using base::UserMetricsAction; | 70 using base::UserMetricsAction; |
| 66 using message_center::Notification; | 71 using message_center::Notification; |
| 67 | 72 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (accelerator.type() == ui::ET_KEY_PRESSED) | 286 if (accelerator.type() == ui::ET_KEY_PRESSED) |
| 282 ime_control_delegate->HandlePreviousIme(); | 287 ime_control_delegate->HandlePreviousIme(); |
| 283 // Else: consume the Ctrl+Space ET_KEY_RELEASED event but do not do anything. | 288 // Else: consume the Ctrl+Space ET_KEY_RELEASED event but do not do anything. |
| 284 } | 289 } |
| 285 | 290 |
| 286 void HandleRestoreTab() { | 291 void HandleRestoreTab() { |
| 287 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); | 292 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); |
| 288 WmShell::Get()->new_window_controller()->RestoreTab(); | 293 WmShell::Get()->new_window_controller()->RestoreTab(); |
| 289 } | 294 } |
| 290 | 295 |
| 296 // Rotate the active window. |
| 297 void HandleRotateActiveWindow() { |
| 298 base::RecordAction(UserMetricsAction("Accel_Rotate_Active_Window")); |
| 299 aura::Window* active_window = wm::GetActiveWindow(); |
| 300 if (!active_window) |
| 301 return; |
| 302 // The rotation animation bases its target transform on the current |
| 303 // rotation and position. Since there could be an animation in progress |
| 304 // right now, queue this animation so when it starts it picks up a neutral |
| 305 // rotation and position. Use replace so we only enqueue one at a time. |
| 306 active_window->layer()->GetAnimator()->set_preemption_strategy( |
| 307 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 308 active_window->layer()->GetAnimator()->StartAnimation( |
| 309 new ui::LayerAnimationSequence( |
| 310 base::MakeUnique<WindowRotation>(360, active_window->layer()))); |
| 311 } |
| 312 |
| 291 void HandleShowKeyboardOverlay() { | 313 void HandleShowKeyboardOverlay() { |
| 292 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); | 314 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| 293 WmShell::Get()->new_window_controller()->ShowKeyboardOverlay(); | 315 WmShell::Get()->new_window_controller()->ShowKeyboardOverlay(); |
| 294 } | 316 } |
| 295 | 317 |
| 296 bool CanHandleShowMessageCenterBubble() { | 318 bool CanHandleShowMessageCenterBubble() { |
| 297 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); | 319 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); |
| 298 StatusAreaWidget* status_area_widget = | 320 StatusAreaWidget* status_area_widget = |
| 299 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); | 321 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 300 return status_area_widget && | 322 return status_area_widget && |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 case MEDIA_PLAY_PAUSE: | 944 case MEDIA_PLAY_PAUSE: |
| 923 case MEDIA_PREV_TRACK: | 945 case MEDIA_PREV_TRACK: |
| 924 case NEW_TAB: | 946 case NEW_TAB: |
| 925 case NEW_WINDOW: | 947 case NEW_WINDOW: |
| 926 case OPEN_CROSH: | 948 case OPEN_CROSH: |
| 927 case OPEN_FEEDBACK_PAGE: | 949 case OPEN_FEEDBACK_PAGE: |
| 928 case OPEN_FILE_MANAGER: | 950 case OPEN_FILE_MANAGER: |
| 929 case OPEN_GET_HELP: | 951 case OPEN_GET_HELP: |
| 930 case PRINT_UI_HIERARCHIES: | 952 case PRINT_UI_HIERARCHIES: |
| 931 case RESTORE_TAB: | 953 case RESTORE_TAB: |
| 954 case ROTATE_WINDOW: |
| 932 case SHOW_IME_MENU_BUBBLE: | 955 case SHOW_IME_MENU_BUBBLE: |
| 933 case SHOW_KEYBOARD_OVERLAY: | 956 case SHOW_KEYBOARD_OVERLAY: |
| 934 case SHOW_SYSTEM_TRAY_BUBBLE: | 957 case SHOW_SYSTEM_TRAY_BUBBLE: |
| 935 case SHOW_TASK_MANAGER: | 958 case SHOW_TASK_MANAGER: |
| 936 case SUSPEND: | 959 case SUSPEND: |
| 937 case TOGGLE_FULLSCREEN: | 960 case TOGGLE_FULLSCREEN: |
| 938 case TOGGLE_HIGH_CONTRAST: | 961 case TOGGLE_HIGH_CONTRAST: |
| 939 case TOGGLE_MAXIMIZED: | 962 case TOGGLE_MAXIMIZED: |
| 940 case TOGGLE_OVERVIEW: | 963 case TOGGLE_OVERVIEW: |
| 941 case TOGGLE_SPOKEN_FEEDBACK: | 964 case TOGGLE_SPOKEN_FEEDBACK: |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 break; | 1115 break; |
| 1093 case PREVIOUS_IME: | 1116 case PREVIOUS_IME: |
| 1094 HandlePreviousIme(ime_control_delegate_.get(), accelerator); | 1117 HandlePreviousIme(ime_control_delegate_.get(), accelerator); |
| 1095 break; | 1118 break; |
| 1096 case PRINT_UI_HIERARCHIES: | 1119 case PRINT_UI_HIERARCHIES: |
| 1097 debug::PrintUIHierarchies(); | 1120 debug::PrintUIHierarchies(); |
| 1098 break; | 1121 break; |
| 1099 case RESTORE_TAB: | 1122 case RESTORE_TAB: |
| 1100 HandleRestoreTab(); | 1123 HandleRestoreTab(); |
| 1101 break; | 1124 break; |
| 1125 case ROTATE_WINDOW: |
| 1126 HandleRotateActiveWindow(); |
| 1127 break; |
| 1102 case SHOW_IME_MENU_BUBBLE: | 1128 case SHOW_IME_MENU_BUBBLE: |
| 1103 HandleShowImeMenuBubble(); | 1129 HandleShowImeMenuBubble(); |
| 1104 break; | 1130 break; |
| 1105 case SHOW_KEYBOARD_OVERLAY: | 1131 case SHOW_KEYBOARD_OVERLAY: |
| 1106 HandleShowKeyboardOverlay(); | 1132 HandleShowKeyboardOverlay(); |
| 1107 break; | 1133 break; |
| 1108 case SHOW_MESSAGE_CENTER_BUBBLE: | 1134 case SHOW_MESSAGE_CENTER_BUBBLE: |
| 1109 HandleShowMessageCenterBubble(); | 1135 HandleShowMessageCenterBubble(); |
| 1110 break; | 1136 break; |
| 1111 case SHOW_STYLUS_TOOLS: | 1137 case SHOW_STYLUS_TOOLS: |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 data->uma_histogram_name, data->notification_message_id, | 1287 data->uma_histogram_name, data->notification_message_id, |
| 1262 data->old_shortcut_id, data->new_shortcut_id); | 1288 data->old_shortcut_id, data->new_shortcut_id); |
| 1263 | 1289 |
| 1264 if (!data->deprecated_enabled) | 1290 if (!data->deprecated_enabled) |
| 1265 return AcceleratorProcessingStatus::STOP; | 1291 return AcceleratorProcessingStatus::STOP; |
| 1266 | 1292 |
| 1267 return AcceleratorProcessingStatus::PROCEED; | 1293 return AcceleratorProcessingStatus::PROCEED; |
| 1268 } | 1294 } |
| 1269 | 1295 |
| 1270 } // namespace ash | 1296 } // namespace ash |
| OLD | NEW |