| 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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 void AccessibilityManager::InputMethodChanged( | 860 void AccessibilityManager::InputMethodChanged( |
| 861 input_method::InputMethodManager* manager, | 861 input_method::InputMethodManager* manager, |
| 862 bool show_message) { | 862 bool show_message) { |
| 863 #if defined(USE_ASH) | 863 #if defined(USE_ASH) |
| 864 // Sticky keys is implemented only in ash. | 864 // Sticky keys is implemented only in ash. |
| 865 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( | 865 ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( |
| 866 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), | 866 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), |
| 867 manager->IsAltGrUsedByCurrentInputMethod()); | 867 manager->IsAltGrUsedByCurrentInputMethod()); |
| 868 #endif | 868 #endif |
| 869 const chromeos::input_method::InputMethodDescriptor descriptor = | 869 const chromeos::input_method::InputMethodDescriptor descriptor = |
| 870 manager->GetCurrentInputMethod(); | 870 manager->GetActiveIMEState()->GetCurrentInputMethod(); |
| 871 braille_ime_current_ = | 871 braille_ime_current_ = |
| 872 (descriptor.id() == extension_misc::kBrailleImeEngineId); | 872 (descriptor.id() == extension_misc::kBrailleImeEngineId); |
| 873 } | 873 } |
| 874 | 874 |
| 875 void AccessibilityManager::SetProfile(Profile* profile) { | 875 void AccessibilityManager::SetProfile(Profile* profile) { |
| 876 pref_change_registrar_.reset(); | 876 pref_change_registrar_.reset(); |
| 877 local_state_pref_change_registrar_.reset(); | 877 local_state_pref_change_registrar_.reset(); |
| 878 | 878 |
| 879 if (profile) { | 879 if (profile) { |
| 880 // TODO(yoshiki): Move following code to PrefHandler. | 880 // TODO(yoshiki): Move following code to PrefHandler. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 braille_display_connected_, | 1088 braille_display_connected_, |
| 1089 ash::A11Y_NOTIFICATION_SHOW); | 1089 ash::A11Y_NOTIFICATION_SHOW); |
| 1090 NotifyAccessibilityStatusChanged(details); | 1090 NotifyAccessibilityStatusChanged(details); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { | 1093 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { |
| 1094 // Ensure the braille IME is active on braille keyboard (dots) input. | 1094 // Ensure the braille IME is active on braille keyboard (dots) input. |
| 1095 if ((event.command == | 1095 if ((event.command == |
| 1096 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && | 1096 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && |
| 1097 !braille_ime_current_) { | 1097 !braille_ime_current_) { |
| 1098 input_method::InputMethodManager::Get()->ChangeInputMethod( | 1098 input_method::InputMethodManager::Get() |
| 1099 extension_misc::kBrailleImeEngineId); | 1099 ->GetActiveIMEState() |
| 1100 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, |
| 1101 false /* show_message */); |
| 1100 } | 1102 } |
| 1101 } | 1103 } |
| 1102 | 1104 |
| 1103 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { | 1105 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { |
| 1104 // Do any setup work needed immediately after ChromeVox actually loads. | 1106 // Do any setup work needed immediately after ChromeVox actually loads. |
| 1105 if (system_sounds_enabled_) | 1107 if (system_sounds_enabled_) |
| 1106 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); | 1108 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); |
| 1107 | 1109 |
| 1108 ExtensionAccessibilityEventRouter::GetInstance()-> | 1110 ExtensionAccessibilityEventRouter::GetInstance()-> |
| 1109 OnChromeVoxLoadStateChanged(profile_, | 1111 OnChromeVoxLoadStateChanged(profile_, |
| 1110 IsSpokenFeedbackEnabled(), | 1112 IsSpokenFeedbackEnabled(), |
| 1111 chrome_vox_loaded_on_lock_screen_ || | 1113 chrome_vox_loaded_on_lock_screen_ || |
| 1112 should_speak_chrome_vox_announcements_on_user_screen_); | 1114 should_speak_chrome_vox_announcements_on_user_screen_); |
| 1113 | 1115 |
| 1114 should_speak_chrome_vox_announcements_on_user_screen_ = | 1116 should_speak_chrome_vox_announcements_on_user_screen_ = |
| 1115 chrome_vox_loaded_on_lock_screen_; | 1117 chrome_vox_loaded_on_lock_screen_; |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1120 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
| 1119 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1121 // Do any teardown work needed immediately after ChromeVox actually unloads. |
| 1120 if (system_sounds_enabled_) | 1122 if (system_sounds_enabled_) |
| 1121 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1123 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1122 } | 1124 } |
| 1123 | 1125 |
| 1124 } // namespace chromeos | 1126 } // namespace chromeos |
| OLD | NEW |