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 <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // being pressed and released, then ignore the release of the | 477 // being pressed and released, then ignore the release of the |
478 // Search key. | 478 // Search key. |
479 if (previous_accelerator.type() != ui::ET_KEY_PRESSED || | 479 if (previous_accelerator.type() != ui::ET_KEY_PRESSED || |
480 previous_accelerator.key_code() != ui::VKEY_LWIN) { | 480 previous_accelerator.key_code() != ui::VKEY_LWIN) { |
481 return false; | 481 return false; |
482 } | 482 } |
483 | 483 |
484 // When spoken feedback is enabled, we should neither toggle the list nor | 484 // When spoken feedback is enabled, we should neither toggle the list nor |
485 // consume the key since Search+Shift is one of the shortcuts the a11y | 485 // consume the key since Search+Shift is one of the shortcuts the a11y |
486 // feature uses. crbug.com/132296 | 486 // feature uses. crbug.com/132296 |
487 if (WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled()) | 487 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) |
488 return false; | 488 return false; |
489 } | 489 } |
490 return true; | 490 return true; |
491 } | 491 } |
492 | 492 |
493 void HandleToggleAppList(const ui::Accelerator& accelerator) { | 493 void HandleToggleAppList(const ui::Accelerator& accelerator) { |
494 if (accelerator.key_code() == ui::VKEY_LWIN) | 494 if (accelerator.key_code() == ui::VKEY_LWIN) |
495 base::RecordAction(base::UserMetricsAction("Accel_Search_LWin")); | 495 base::RecordAction(base::UserMetricsAction("Accel_Search_LWin")); |
496 Shell::GetInstance()->ToggleAppList(NULL); | 496 Shell::GetInstance()->ToggleAppList(NULL); |
497 } | 497 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 void HandleToggleMirrorMode() { | 659 void HandleToggleMirrorMode() { |
660 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); | 660 base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
661 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); | 661 bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); |
662 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( | 662 Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( |
663 mirror, true /* user_action */); | 663 mirror, true /* user_action */); |
664 } | 664 } |
665 | 665 |
666 void HandleToggleSpokenFeedback() { | 666 void HandleToggleSpokenFeedback() { |
667 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); | 667 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
668 | 668 |
669 WmShell::Get()->GetAccessibilityDelegate()->ToggleSpokenFeedback( | 669 WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( |
670 A11Y_NOTIFICATION_SHOW); | 670 A11Y_NOTIFICATION_SHOW); |
671 } | 671 } |
672 | 672 |
673 bool CanHandleTouchHud() { | 673 bool CanHandleTouchHud() { |
674 return RootWindowController::ForTargetRootWindow()->touch_hud_debug(); | 674 return RootWindowController::ForTargetRootWindow()->touch_hud_debug(); |
675 } | 675 } |
676 | 676 |
677 void HandleTouchHudClear() { | 677 void HandleTouchHudClear() { |
678 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear(); | 678 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear(); |
679 } | 679 } |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 actions_allowed_at_modal_window_.find(action) == | 1400 actions_allowed_at_modal_window_.find(action) == |
1401 actions_allowed_at_modal_window_.end()) { | 1401 actions_allowed_at_modal_window_.end()) { |
1402 // Note we prevent the shortcut from propagating so it will not | 1402 // Note we prevent the shortcut from propagating so it will not |
1403 // be passed to the modal window. This is important for things like | 1403 // be passed to the modal window. This is important for things like |
1404 // Alt+Tab that would cause an undesired effect in the modal window by | 1404 // Alt+Tab that would cause an undesired effect in the modal window by |
1405 // cycling through its window elements. | 1405 // cycling through its window elements. |
1406 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1406 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
1407 } | 1407 } |
1408 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && | 1408 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && |
1409 actions_needing_window_.find(action) != actions_needing_window_.end()) { | 1409 actions_needing_window_.find(action) != actions_needing_window_.end()) { |
1410 wm_shell->GetAccessibilityDelegate()->TriggerAccessibilityAlert( | 1410 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( |
1411 A11Y_ALERT_WINDOW_NEEDED); | 1411 A11Y_ALERT_WINDOW_NEEDED); |
1412 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1412 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
1413 } | 1413 } |
1414 return RESTRICTION_NONE; | 1414 return RESTRICTION_NONE; |
1415 } | 1415 } |
1416 | 1416 |
1417 } // namespace ash | 1417 } // namespace ash |
OLD | NEW |