| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 6 | 6 |
| 7 #include "ash/audio/sounds.h" | 7 #include "ash/audio/sounds.h" |
| 8 #include "ash/autoclick/autoclick_controller.h" | 8 #include "ash/autoclick/autoclick_controller.h" |
| 9 #include "ash/high_contrast/high_contrast_controller.h" | 9 #include "ash/high_contrast/high_contrast_controller.h" |
| 10 #include "ash/metrics/user_metrics_recorder.h" | 10 #include "ash/metrics/user_metrics_recorder.h" |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 void AccessibilityManager::InputMethodChanged( | 850 void AccessibilityManager::InputMethodChanged( |
| 851 input_method::InputMethodManager* manager, | 851 input_method::InputMethodManager* manager, |
| 852 bool show_message) { | 852 bool show_message) { |
| 853 #if defined(USE_ASH) | 853 #if defined(USE_ASH) |
| 854 // Sticky keys is implemented only in ash. | 854 // Sticky keys is implemented only in ash. |
| 855 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( | 855 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( |
| 856 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), | 856 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), |
| 857 manager->IsAltGrUsedByCurrentInputMethod()); | 857 manager->IsAltGrUsedByCurrentInputMethod()); |
| 858 #endif | 858 #endif |
| 859 const chromeos::input_method::InputMethodDescriptor descriptor = | 859 const chromeos::input_method::InputMethodDescriptor descriptor = |
| 860 manager->GetCurrentInputMethod(); | 860 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
| 861 braille_ime_current_ = | 861 braille_ime_current_ = |
| 862 (descriptor.id() == extension_misc::kBrailleImeEngineId); | 862 (descriptor.id() == extension_misc::kBrailleImeEngineId); |
| 863 } | 863 } |
| 864 | 864 |
| 865 void AccessibilityManager::SetProfile(Profile* profile) { | 865 void AccessibilityManager::SetProfile(Profile* profile) { |
| 866 pref_change_registrar_.reset(); | 866 pref_change_registrar_.reset(); |
| 867 local_state_pref_change_registrar_.reset(); | 867 local_state_pref_change_registrar_.reset(); |
| 868 | 868 |
| 869 if (profile) { | 869 if (profile) { |
| 870 // TODO(yoshiki): Move following code to PrefHandler. | 870 // TODO(yoshiki): Move following code to PrefHandler. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 braille_display_connected_, | 1078 braille_display_connected_, |
| 1079 ash::A11Y_NOTIFICATION_SHOW); | 1079 ash::A11Y_NOTIFICATION_SHOW); |
| 1080 NotifyAccessibilityStatusChanged(details); | 1080 NotifyAccessibilityStatusChanged(details); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { | 1083 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { |
| 1084 // Ensure the braille IME is active on braille keyboard (dots) input. | 1084 // Ensure the braille IME is active on braille keyboard (dots) input. |
| 1085 if ((event.command == | 1085 if ((event.command == |
| 1086 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && | 1086 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && |
| 1087 !braille_ime_current_) { | 1087 !braille_ime_current_) { |
| 1088 input_method::InputMethodManager::Get()->ChangeInputMethod( | 1088 input_method::InputMethodManager::Get() |
| 1089 extension_misc::kBrailleImeEngineId); | 1089 ->GetActiveIMEState() |
| 1090 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, |
| 1091 false /* show_message */); |
| 1090 } | 1092 } |
| 1091 } | 1093 } |
| 1092 | 1094 |
| 1093 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { | 1095 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { |
| 1094 // Do any setup work needed immediately after ChromeVox actually loads. | 1096 // Do any setup work needed immediately after ChromeVox actually loads. |
| 1095 if (system_sounds_enabled_) | 1097 if (system_sounds_enabled_) |
| 1096 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); | 1098 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); |
| 1097 | 1099 |
| 1098 ExtensionAccessibilityEventRouter::GetInstance()-> | 1100 ExtensionAccessibilityEventRouter::GetInstance()-> |
| 1099 OnChromeVoxLoadStateChanged(profile_, | 1101 OnChromeVoxLoadStateChanged(profile_, |
| 1100 IsSpokenFeedbackEnabled(), | 1102 IsSpokenFeedbackEnabled(), |
| 1101 chrome_vox_loaded_on_lock_screen_ || | 1103 chrome_vox_loaded_on_lock_screen_ || |
| 1102 should_speak_chrome_vox_announcements_on_user_screen_); | 1104 should_speak_chrome_vox_announcements_on_user_screen_); |
| 1103 | 1105 |
| 1104 should_speak_chrome_vox_announcements_on_user_screen_ = | 1106 should_speak_chrome_vox_announcements_on_user_screen_ = |
| 1105 chrome_vox_loaded_on_lock_screen_; | 1107 chrome_vox_loaded_on_lock_screen_; |
| 1106 } | 1108 } |
| 1107 | 1109 |
| 1108 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1110 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
| 1109 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1111 // Do any teardown work needed immediately after ChromeVox actually unloads. |
| 1110 if (system_sounds_enabled_) | 1112 if (system_sounds_enabled_) |
| 1111 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1113 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1112 } | 1114 } |
| 1113 | 1115 |
| 1114 } // namespace chromeos | 1116 } // namespace chromeos |
| OLD | NEW |