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

Side by Side Diff: ash/common/accelerators/accelerator_controller.cc

Issue 2256283003: Refuse to show Alt+Tab UI concurrently with virtual keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no op instead Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
(...skipping 15 matching lines...) Expand all
26 #include "ash/common/wm/window_cycle_controller.h" 26 #include "ash/common/wm/window_cycle_controller.h"
27 #include "ash/common/wm/window_positioning_utils.h" 27 #include "ash/common/wm/window_positioning_utils.h"
28 #include "ash/common/wm/window_state.h" 28 #include "ash/common/wm/window_state.h"
29 #include "ash/common/wm/wm_event.h" 29 #include "ash/common/wm/wm_event.h"
30 #include "ash/common/wm_shell.h" 30 #include "ash/common/wm_shell.h"
31 #include "ash/common/wm_window.h" 31 #include "ash/common/wm_window.h"
32 #include "base/metrics/histogram_macros.h" 32 #include "base/metrics/histogram_macros.h"
33 #include "base/metrics/user_metrics.h" 33 #include "base/metrics/user_metrics.h"
34 #include "ui/base/accelerators/accelerator.h" 34 #include "ui/base/accelerators/accelerator.h"
35 #include "ui/base/accelerators/accelerator_manager.h" 35 #include "ui/base/accelerators/accelerator_manager.h"
36 #include "ui/keyboard/keyboard_controller.h"
36 37
37 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
38 #include "chromeos/dbus/dbus_thread_manager.h" 39 #include "chromeos/dbus/dbus_thread_manager.h"
39 #include "chromeos/dbus/power_manager_client.h" 40 #include "chromeos/dbus/power_manager_client.h"
40 #include "ui/base/ime/chromeos/ime_keyboard.h" 41 #include "ui/base/ime/chromeos/ime_keyboard.h"
41 #include "ui/base/ime/chromeos/input_method_manager.h" 42 #include "ui/base/ime/chromeos/input_method_manager.h"
42 #endif // defined(OS_CHROMEOS) 43 #endif // defined(OS_CHROMEOS)
43 44
44 namespace ash { 45 namespace ash {
45 namespace { 46 namespace {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 917 }
917 } 918 }
918 919
919 bool AcceleratorController::ShouldActionConsumeKeyEvent( 920 bool AcceleratorController::ShouldActionConsumeKeyEvent(
920 AcceleratorAction action) { 921 AcceleratorAction action) {
921 // Adding new exceptions is *STRONGLY* discouraged. 922 // Adding new exceptions is *STRONGLY* discouraged.
922 return true; 923 return true;
923 } 924 }
924 925
925 AcceleratorController::AcceleratorProcessingRestriction 926 AcceleratorController::AcceleratorProcessingRestriction
926 AcceleratorController::GetAcceleratorProcessingRestriction(int action) { 927 AcceleratorController::GetAcceleratorProcessingRestriction(int action) {
varkha 2016/08/22 20:59:23 Maybe deserves a followup. Is there a good reason
Evan Stade 2016/08/22 21:35:04 dunno, seems tangential to this CL though.
927 if (WmShell::Get()->IsPinned() && 928 WmShell* wm_shell = WmShell::Get();
929 if (wm_shell->IsPinned() &&
928 actions_allowed_in_pinned_mode_.find(action) == 930 actions_allowed_in_pinned_mode_.find(action) ==
929 actions_allowed_in_pinned_mode_.end()) { 931 actions_allowed_in_pinned_mode_.end()) {
930 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 932 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
931 } 933 }
932 WmShell* wm_shell = WmShell::Get();
933 if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() && 934 if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() &&
934 actions_allowed_at_login_screen_.find(action) == 935 actions_allowed_at_login_screen_.find(action) ==
935 actions_allowed_at_login_screen_.end()) { 936 actions_allowed_at_login_screen_.end()) {
936 return RESTRICTION_PREVENT_PROCESSING; 937 return RESTRICTION_PREVENT_PROCESSING;
937 } 938 }
938 if (wm_shell->GetSessionStateDelegate()->IsScreenLocked() && 939 if (wm_shell->GetSessionStateDelegate()->IsScreenLocked() &&
939 actions_allowed_at_lock_screen_.find(action) == 940 actions_allowed_at_lock_screen_.find(action) ==
940 actions_allowed_at_lock_screen_.end()) { 941 actions_allowed_at_lock_screen_.end()) {
941 return RESTRICTION_PREVENT_PROCESSING; 942 return RESTRICTION_PREVENT_PROCESSING;
942 } 943 }
(...skipping 10 matching lines...) Expand all
953 // Alt+Tab that would cause an undesired effect in the modal window by 954 // Alt+Tab that would cause an undesired effect in the modal window by
954 // cycling through its window elements. 955 // cycling through its window elements.
955 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 956 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
956 } 957 }
957 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 958 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
958 actions_needing_window_.find(action) != actions_needing_window_.end()) { 959 actions_needing_window_.find(action) != actions_needing_window_.end()) {
959 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 960 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
960 A11Y_ALERT_WINDOW_NEEDED); 961 A11Y_ALERT_WINDOW_NEEDED);
961 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 962 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
962 } 963 }
964 // Don't do anything when Alt+Tab comes from a virtual keyboard. Touchscreen
965 // users have better window switching options. See http://crbug.com/638269
966 keyboard::KeyboardController* keyboard_controller =
967 keyboard::KeyboardController::GetInstance();
968 if (keyboard_controller && keyboard_controller->keyboard_visible())
969 return RESTRICTION_PREVENT_PROCESSING;
oshima 2016/08/18 23:53:31 This disable alt-tab even if I used the real keybo
varkha 2016/08/22 20:59:23 Maybe we can plumb through a ui::Accelerator param
bshe 2016/08/22 21:02:56 If alt + tab is disabled for VK, it is probably be
Evan Stade 2016/08/22 21:35:04 seems very not worth it. Why is a user using both
Evan Stade 2016/08/22 21:35:04 How would one do that? By special casing to ignore
970
963 return RESTRICTION_NONE; 971 return RESTRICTION_NONE;
964 } 972 }
965 973
966 } // namespace ash 974 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698