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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "ash/shell_window_ids.h" | 37 #include "ash/shell_window_ids.h" |
38 #include "ash/system/brightness_control_delegate.h" | 38 #include "ash/system/brightness_control_delegate.h" |
39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
40 #include "ash/system/status_area_widget.h" | 40 #include "ash/system/status_area_widget.h" |
41 #include "ash/system/tray/system_tray.h" | 41 #include "ash/system/tray/system_tray.h" |
42 #include "ash/system/tray/system_tray_delegate.h" | 42 #include "ash/system/tray/system_tray_delegate.h" |
43 #include "ash/system/tray/system_tray_notifier.h" | 43 #include "ash/system/tray/system_tray_notifier.h" |
44 #include "ash/system/web_notification/web_notification_tray.h" | 44 #include "ash/system/web_notification/web_notification_tray.h" |
45 #include "ash/touch/touch_hud_debug.h" | 45 #include "ash/touch/touch_hud_debug.h" |
46 #include "ash/volume_control_delegate.h" | 46 #include "ash/volume_control_delegate.h" |
| 47 #include "ash/wm/mru_window_tracker.h" |
47 #include "ash/wm/overview/window_selector_controller.h" | 48 #include "ash/wm/overview/window_selector_controller.h" |
48 #include "ash/wm/partial_screenshot_view.h" | 49 #include "ash/wm/partial_screenshot_view.h" |
49 #include "ash/wm/power_button_controller.h" | 50 #include "ash/wm/power_button_controller.h" |
50 #include "ash/wm/window_cycle_controller.h" | 51 #include "ash/wm/window_cycle_controller.h" |
51 #include "ash/wm/window_state.h" | 52 #include "ash/wm/window_state.h" |
52 #include "ash/wm/window_util.h" | 53 #include "ash/wm/window_util.h" |
53 #include "ash/wm/workspace/snap_sizer.h" | 54 #include "ash/wm/workspace/snap_sizer.h" |
54 #include "base/bind.h" | 55 #include "base/bind.h" |
55 #include "base/command_line.h" | 56 #include "base/command_line.h" |
56 #include "content/public/browser/gpu_data_manager.h" | 57 #include "content/public/browser/gpu_data_manager.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) | 430 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) |
430 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); | 431 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); |
431 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) | 432 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) |
432 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); | 433 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); |
433 for (size_t i = 0; i < kReservedActionsLength; ++i) | 434 for (size_t i = 0; i < kReservedActionsLength; ++i) |
434 reserved_actions_.insert(kReservedActions[i]); | 435 reserved_actions_.insert(kReservedActions[i]); |
435 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) | 436 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) |
436 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); | 437 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); |
437 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) | 438 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) |
438 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); | 439 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); |
| 440 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) |
| 441 actions_needing_window_.insert(kActionsNeedingWindow[i]); |
439 | 442 |
440 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); | 443 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); |
441 | 444 |
442 #if !defined(NDEBUG) | 445 #if !defined(NDEBUG) |
443 RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength); | 446 RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength); |
444 #endif | 447 #endif |
445 | 448 |
446 if (DebugShortcutsEnabled()) { | 449 if (DebugShortcutsEnabled()) { |
447 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); | 450 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); |
448 for (size_t i = 0; i < kReservedDebugActionsLength; ++i) | 451 for (size_t i = 0; i < kReservedDebugActionsLength; ++i) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 // and will not be passed to the modal window. This is important | 520 // and will not be passed to the modal window. This is important |
518 // for things like Alt+Tab that would cause an undesired effect | 521 // for things like Alt+Tab that would cause an undesired effect |
519 // in the modal window by cycling through its window elements. | 522 // in the modal window by cycling through its window elements. |
520 return true; | 523 return true; |
521 } | 524 } |
522 if (shell->delegate()->IsRunningInForcedAppMode() && | 525 if (shell->delegate()->IsRunningInForcedAppMode() && |
523 actions_allowed_in_app_mode_.find(action) == | 526 actions_allowed_in_app_mode_.find(action) == |
524 actions_allowed_in_app_mode_.end()) { | 527 actions_allowed_in_app_mode_.end()) { |
525 return false; | 528 return false; |
526 } | 529 } |
| 530 if (MruWindowTracker::BuildWindowList(false).empty() && |
| 531 actions_needing_window_.find(action) != actions_needing_window_.end()) { |
| 532 Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( |
| 533 A11Y_ALERT_WINDOW_NEEDED); |
| 534 return true; |
| 535 } |
527 | 536 |
528 const ui::KeyboardCode key_code = accelerator.key_code(); | 537 const ui::KeyboardCode key_code = accelerator.key_code(); |
529 // PerformAction() is performed from gesture controllers and passes | 538 // PerformAction() is performed from gesture controllers and passes |
530 // empty Accelerator() instance as the second argument. Such events | 539 // empty Accelerator() instance as the second argument. Such events |
531 // should never be suspended. | 540 // should never be suspended. |
532 const bool gesture_event = key_code == ui::VKEY_UNKNOWN; | 541 const bool gesture_event = key_code == ui::VKEY_UNKNOWN; |
533 | 542 |
534 // Ignore accelerators invoked as repeated (while holding a key for a long | 543 // Ignore accelerators invoked as repeated (while holding a key for a long |
535 // time, if their handling is nonrepeatable. | 544 // time, if their handling is nonrepeatable. |
536 if (nonrepeatable_actions_.find(action) != nonrepeatable_actions_.end() && | 545 if (nonrepeatable_actions_.find(action) != nonrepeatable_actions_.end() && |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 keyboard_brightness_control_delegate) { | 1005 keyboard_brightness_control_delegate) { |
997 keyboard_brightness_control_delegate_ = | 1006 keyboard_brightness_control_delegate_ = |
998 keyboard_brightness_control_delegate.Pass(); | 1007 keyboard_brightness_control_delegate.Pass(); |
999 } | 1008 } |
1000 | 1009 |
1001 bool AcceleratorController::CanHandleAccelerators() const { | 1010 bool AcceleratorController::CanHandleAccelerators() const { |
1002 return true; | 1011 return true; |
1003 } | 1012 } |
1004 | 1013 |
1005 } // namespace ash | 1014 } // namespace ash |
OLD | NEW |