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

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

Issue 2604093003: Don't mark virtual keyboard events as synthesized or distinguish between (Closed)
Patch Set: longer docs Created 3 years, 11 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 | chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc » ('j') | 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 <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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void HandleNewWindow() { 162 void HandleNewWindow() {
163 base::RecordAction(UserMetricsAction("Accel_New_Window")); 163 base::RecordAction(UserMetricsAction("Accel_New_Window"));
164 WmShell::Get()->new_window_controller()->NewWindow(false /* is_incognito */); 164 WmShell::Get()->new_window_controller()->NewWindow(false /* is_incognito */);
165 } 165 }
166 166
167 bool CanHandleNextIme(ImeControlDelegate* ime_control_delegate) { 167 bool CanHandleNextIme(ImeControlDelegate* ime_control_delegate) {
168 return ime_control_delegate && ime_control_delegate->CanCycleIme(); 168 return ime_control_delegate && ime_control_delegate->CanCycleIme();
169 } 169 }
170 170
171 bool CanHandleCycleMru(const ui::Accelerator& accelerator) { 171 bool CanHandleCycleMru(const ui::Accelerator& accelerator) {
172 // Don't do anything when Alt+Tab comes from a virtual keyboard. Touchscreen 172 // Don't do anything when Alt+Tab is hit while a virtual keyboard is showing.
173 // users have better window switching options. See http://crbug.com/638269 173 // Touchscreen users have better window switching options. It would be
174 // preferable if we could tell whether this event actually came from a virtual
175 // keyboard, but there's no easy way to do so, thus we block Alt+Tab when the
176 // virtual keyboard is showing, even if it came from a real keyboard. See
177 // http://crbug.com/638269
174 keyboard::KeyboardController* keyboard_controller = 178 keyboard::KeyboardController* keyboard_controller =
175 keyboard::KeyboardController::GetInstance(); 179 keyboard::KeyboardController::GetInstance();
176 return !(keyboard_controller && keyboard_controller->keyboard_visible() && 180 return !(keyboard_controller && keyboard_controller->keyboard_visible());
177 (accelerator.modifiers() & ui::EF_IS_SYNTHESIZED));
178 } 181 }
179 182
180 // We must avoid showing the Deprecated NEXT_IME notification erronously. 183 // We must avoid showing the Deprecated NEXT_IME notification erronously.
181 bool ShouldShowDeprecatedNextImeNotification( 184 bool ShouldShowDeprecatedNextImeNotification(
182 const ui::Accelerator& previous_accelerator) { 185 const ui::Accelerator& previous_accelerator) {
183 // We only show the deprecation notification if the previous accelerator key 186 // We only show the deprecation notification if the previous accelerator key
184 // is ONLY either Shift, or Alt. 187 // is ONLY either Shift, or Alt.
185 const ui::KeyboardCode previous_key_code = previous_accelerator.key_code(); 188 const ui::KeyboardCode previous_key_code = previous_accelerator.key_code();
186 switch (previous_key_code) { 189 switch (previous_key_code) {
187 case ui::VKEY_SHIFT: 190 case ui::VKEY_SHIFT:
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 1171 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1169 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1172 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1170 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1173 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
1171 A11Y_ALERT_WINDOW_NEEDED); 1174 A11Y_ALERT_WINDOW_NEEDED);
1172 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1175 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1173 } 1176 }
1174 return RESTRICTION_NONE; 1177 return RESTRICTION_NONE;
1175 } 1178 }
1176 1179
1177 } // namespace ash 1180 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698