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

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

Issue 2352213002: Add Ctrl+Alt+H as global shortcut to toggle high contrast mode. (Closed)
Patch Set: Created 4 years, 3 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
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 460
461 void HandleToggleCapsLock() { 461 void HandleToggleCapsLock() {
462 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); 462 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock"));
463 chromeos::input_method::InputMethodManager* ime = 463 chromeos::input_method::InputMethodManager* ime =
464 chromeos::input_method::InputMethodManager::Get(); 464 chromeos::input_method::InputMethodManager::Get();
465 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard(); 465 chromeos::input_method::ImeKeyboard* keyboard = ime->GetImeKeyboard();
466 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled()); 466 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled());
467 } 467 }
468 468
469 void HandleToggleHighContrast() {
James Cook 2016/09/20 21:37:13 Thanks for keeping the functions alphabetized.
470 base::RecordAction(UserMetricsAction("Accel_Toggle_High_Contrast"));
471
472 WmShell::Get()->accessibility_delegate()->ToggleHighContrast();
473 }
474
469 void HandleToggleSpokenFeedback() { 475 void HandleToggleSpokenFeedback() {
470 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); 476 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback"));
471 477
472 WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( 478 WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback(
473 A11Y_NOTIFICATION_SHOW); 479 A11Y_NOTIFICATION_SHOW);
474 } 480 }
475 481
476 void HandleVolumeDown(const ui::Accelerator& accelerator) { 482 void HandleVolumeDown(const ui::Accelerator& accelerator) {
477 VolumeControlDelegate* volume_delegate = 483 VolumeControlDelegate* volume_delegate =
478 WmShell::Get()->system_tray_delegate()->GetVolumeControlDelegate(); 484 WmShell::Get()->system_tray_delegate()->GetVolumeControlDelegate();
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 #if defined(OS_CHROMEOS) 825 #if defined(OS_CHROMEOS)
820 case BRIGHTNESS_DOWN: 826 case BRIGHTNESS_DOWN:
821 case BRIGHTNESS_UP: 827 case BRIGHTNESS_UP:
822 case KEYBOARD_BRIGHTNESS_DOWN: 828 case KEYBOARD_BRIGHTNESS_DOWN:
823 case KEYBOARD_BRIGHTNESS_UP: 829 case KEYBOARD_BRIGHTNESS_UP:
824 case OPEN_CROSH: 830 case OPEN_CROSH:
825 case OPEN_FILE_MANAGER: 831 case OPEN_FILE_MANAGER:
826 case OPEN_GET_HELP: 832 case OPEN_GET_HELP:
827 case SHOW_IME_MENU_BUBBLE: 833 case SHOW_IME_MENU_BUBBLE:
828 case SUSPEND: 834 case SUSPEND:
835 case TOGGLE_HIGH_CONTRAST:
829 case TOGGLE_SPOKEN_FEEDBACK: 836 case TOGGLE_SPOKEN_FEEDBACK:
830 case TOGGLE_WIFI: 837 case TOGGLE_WIFI:
831 case VOLUME_DOWN: 838 case VOLUME_DOWN:
832 case VOLUME_MUTE: 839 case VOLUME_MUTE:
833 case VOLUME_UP: 840 case VOLUME_UP:
834 #else 841 #else
835 case DUMMY_FOR_RESERVED: 842 case DUMMY_FOR_RESERVED:
836 #endif 843 #endif
837 return true; 844 return true;
838 845
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 break; 1043 break;
1037 case SWITCH_TO_NEXT_USER: 1044 case SWITCH_TO_NEXT_USER:
1038 HandleCycleUser(SessionStateDelegate::CYCLE_TO_NEXT_USER); 1045 HandleCycleUser(SessionStateDelegate::CYCLE_TO_NEXT_USER);
1039 break; 1046 break;
1040 case SWITCH_TO_PREVIOUS_USER: 1047 case SWITCH_TO_PREVIOUS_USER:
1041 HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER); 1048 HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER);
1042 break; 1049 break;
1043 case TOGGLE_CAPS_LOCK: 1050 case TOGGLE_CAPS_LOCK:
1044 HandleToggleCapsLock(); 1051 HandleToggleCapsLock();
1045 break; 1052 break;
1053 case TOGGLE_HIGH_CONTRAST:
1054 HandleToggleHighContrast();
1055 break;
1046 case TOGGLE_SPOKEN_FEEDBACK: 1056 case TOGGLE_SPOKEN_FEEDBACK:
1047 HandleToggleSpokenFeedback(); 1057 HandleToggleSpokenFeedback();
1048 break; 1058 break;
1049 case TOGGLE_WIFI: 1059 case TOGGLE_WIFI:
1050 WmShell::Get()->system_tray_notifier()->NotifyRequestToggleWifi(); 1060 WmShell::Get()->system_tray_notifier()->NotifyRequestToggleWifi();
1051 break; 1061 break;
1052 case VOLUME_DOWN: 1062 case VOLUME_DOWN:
1053 HandleVolumeDown(accelerator); 1063 HandleVolumeDown(accelerator);
1054 break; 1064 break;
1055 case VOLUME_MUTE: 1065 case VOLUME_MUTE:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 1123 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1114 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1124 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1115 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1125 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
1116 A11Y_ALERT_WINDOW_NEEDED); 1126 A11Y_ALERT_WINDOW_NEEDED);
1117 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1127 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1118 } 1128 }
1119 return RESTRICTION_NONE; 1129 return RESTRICTION_NONE;
1120 } 1130 }
1121 1131
1122 } // namespace ash 1132 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_table.h » ('j') | tools/metrics/actions/actions.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698