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

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

Issue 348293002: Do not consume Alt-Shift-Up event for IME switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating unit test expectations. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.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/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 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return true; 222 return true;
223 } 223 }
224 224
225 bool HandleNewWindow() { 225 bool HandleNewWindow() {
226 base::RecordAction(base::UserMetricsAction("Accel_New_Window")); 226 base::RecordAction(base::UserMetricsAction("Accel_New_Window"));
227 Shell::GetInstance()->new_window_delegate()->NewWindow( 227 Shell::GetInstance()->new_window_delegate()->NewWindow(
228 false /* is_incognito */); 228 false /* is_incognito */);
229 return true; 229 return true;
230 } 230 }
231 231
232 bool HandleNextIme(ImeControlDelegate* ime_control_delegate, 232 void HandleNextIme(ImeControlDelegate* ime_control_delegate,
233 ui::EventType previous_event_type, 233 ui::EventType previous_event_type,
234 ui::KeyboardCode previous_key_code) { 234 ui::KeyboardCode previous_key_code) {
235 // This check is necessary e.g. not to process the Shift+Alt+ 235 // This check is necessary e.g. not to process the Shift+Alt+
236 // ET_KEY_RELEASED accelerator for Chrome OS (see ash/accelerators/ 236 // ET_KEY_RELEASED accelerator for Chrome OS (see ash/accelerators/
237 // accelerator_controller.cc) when Shift+Alt+Tab is pressed and then Tab 237 // accelerator_controller.cc) when Shift+Alt+Tab is pressed and then Tab
238 // is released. 238 // is released.
239 if (previous_event_type == ui::ET_KEY_RELEASED && 239 if (previous_event_type == ui::ET_KEY_RELEASED &&
240 // Workaround for crbug.com/139556. CJK IME users tend to press 240 // Workaround for crbug.com/139556. CJK IME users tend to press
241 // Enter (or Space) and Shift+Alt almost at the same time to commit 241 // Enter (or Space) and Shift+Alt almost at the same time to commit
242 // an IME string and then switch from the IME to the English layout. 242 // an IME string and then switch from the IME to the English layout.
243 // This workaround allows the user to trigger NEXT_IME even if the 243 // This workaround allows the user to trigger NEXT_IME even if the
244 // user presses Shift+Alt before releasing Enter. 244 // user presses Shift+Alt before releasing Enter.
245 // TODO(nona|mazda): Fix crbug.com/139556 in a cleaner way. 245 // TODO(nona|mazda): Fix crbug.com/139556 in a cleaner way.
246 previous_key_code != ui::VKEY_RETURN && 246 previous_key_code != ui::VKEY_RETURN &&
247 previous_key_code != ui::VKEY_SPACE) { 247 previous_key_code != ui::VKEY_SPACE) {
248 // We totally ignore this accelerator. 248 // We totally ignore this accelerator.
249 // TODO(mazda): Fix crbug.com/158217 249 // TODO(mazda): Fix crbug.com/158217
250 return false; 250 return;
251 } 251 }
252 base::RecordAction(UserMetricsAction("Accel_Next_Ime")); 252 base::RecordAction(UserMetricsAction("Accel_Next_Ime"));
253 if (ime_control_delegate) 253 if (ime_control_delegate)
254 return ime_control_delegate->HandleNextIme(); 254 ime_control_delegate->HandleNextIme();
255 return false;
256 } 255 }
257 256
258 bool HandleOpenFeedbackPage() { 257 bool HandleOpenFeedbackPage() {
259 base::RecordAction(UserMetricsAction("Accel_Open_Feedback_Page")); 258 base::RecordAction(UserMetricsAction("Accel_Open_Feedback_Page"));
260 ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage(); 259 ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage();
261 return true; 260 return true;
262 } 261 }
263 262
264 bool HandlePositionCenter() { 263 bool HandlePositionCenter() {
265 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 264 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 case SHOW_KEYBOARD_OVERLAY: 1026 case SHOW_KEYBOARD_OVERLAY:
1028 return HandleShowKeyboardOverlay(); 1027 return HandleShowKeyboardOverlay();
1029 case SHOW_SYSTEM_TRAY_BUBBLE: 1028 case SHOW_SYSTEM_TRAY_BUBBLE:
1030 return HandleShowSystemTrayBubble(); 1029 return HandleShowSystemTrayBubble();
1031 case SHOW_MESSAGE_CENTER_BUBBLE: 1030 case SHOW_MESSAGE_CENTER_BUBBLE:
1032 HandleShowMessageCenterBubble(); 1031 HandleShowMessageCenterBubble();
1033 break; 1032 break;
1034 case SHOW_TASK_MANAGER: 1033 case SHOW_TASK_MANAGER:
1035 return HandleShowTaskManager(); 1034 return HandleShowTaskManager();
1036 case NEXT_IME: 1035 case NEXT_IME:
1037 return HandleNextIme( 1036 HandleNextIme(
1038 ime_control_delegate_.get(), previous_event_type, previous_key_code); 1037 ime_control_delegate_.get(), previous_event_type, previous_key_code);
1038 // NEXT_IME is bound to Alt-Shift key up event. To be consistent with
1039 // Windows behavior, do not consume the key event here.
1040 return false;
1039 case PREVIOUS_IME: 1041 case PREVIOUS_IME:
1040 return HandlePreviousIme(ime_control_delegate_.get(), accelerator); 1042 return HandlePreviousIme(ime_control_delegate_.get(), accelerator);
1041 case PRINT_UI_HIERARCHIES: 1043 case PRINT_UI_HIERARCHIES:
1042 return HandlePrintUIHierarchies(); 1044 return HandlePrintUIHierarchies();
1043 case SWITCH_IME: 1045 case SWITCH_IME:
1044 return HandleSwitchIme(ime_control_delegate_.get(), accelerator); 1046 return HandleSwitchIme(ime_control_delegate_.get(), accelerator);
1045 case LAUNCH_APP_0: 1047 case LAUNCH_APP_0:
1046 return HandleLaunchAppN(0); 1048 return HandleLaunchAppN(0);
1047 case LAUNCH_APP_1: 1049 case LAUNCH_APP_1:
1048 return HandleLaunchAppN(1); 1050 return HandleLaunchAppN(1);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 keyboard_brightness_control_delegate) { 1187 keyboard_brightness_control_delegate) {
1186 keyboard_brightness_control_delegate_ = 1188 keyboard_brightness_control_delegate_ =
1187 keyboard_brightness_control_delegate.Pass(); 1189 keyboard_brightness_control_delegate.Pass();
1188 } 1190 }
1189 1191
1190 bool AcceleratorController::CanHandleAccelerators() const { 1192 bool AcceleratorController::CanHandleAccelerators() const {
1191 return true; 1193 return true;
1192 } 1194 }
1193 1195
1194 } // namespace ash 1196 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698