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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Inject ChromeVox' content scripts. | 215 // Inject ChromeVox' content scripts. |
216 ContentScriptLoader* loader = new ContentScriptLoader( | 216 ContentScriptLoader* loader = new ContentScriptLoader( |
217 extension->id(), render_view_host->GetProcess()->GetID(), | 217 extension->id(), render_view_host->GetProcess()->GetID(), |
218 render_view_host->GetRoutingID()); | 218 render_view_host->GetRoutingID()); |
219 | 219 |
220 const extensions::UserScriptList& content_scripts = | 220 const extensions::UserScriptList& content_scripts = |
221 extensions::ContentScriptsInfo::GetContentScripts(extension); | 221 extensions::ContentScriptsInfo::GetContentScripts(extension); |
222 for (size_t i = 0; i < content_scripts.size(); i++) { | 222 for (size_t i = 0; i < content_scripts.size(); i++) { |
223 const extensions::UserScript& script = content_scripts[i]; | 223 const extensions::UserScript& script = content_scripts[i]; |
224 for (size_t j = 0; j < script.js_scripts().size(); ++j) { | 224 for (size_t j = 0; j < script.js_scripts().size(); ++j) { |
225 const extensions::UserScript::File &file = script.js_scripts()[j]; | 225 const extensions::UserScript::File& file = script.js_scripts()[j]; |
226 extensions::ExtensionResource resource = extension->GetResource( | 226 extensions::ExtensionResource resource = extension->GetResource( |
227 file.relative_path()); | 227 file.relative_path()); |
228 loader->AppendScript(resource); | 228 loader->AppendScript(resource); |
229 } | 229 } |
230 } | 230 } |
231 loader->Run(); // It cleans itself up when done. | 231 loader->Run(); // It cleans itself up when done. |
232 } | 232 } |
233 | 233 |
234 void UnloadChromeVoxExtension(Profile* profile) { | 234 void UnloadChromeVoxExtension(Profile* profile) { |
235 base::FilePath path = GetChromeVoxPath(); | 235 base::FilePath path = GetChromeVoxPath(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 366 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
367 media::SoundsManager* manager = media::SoundsManager::Get(); | 367 media::SoundsManager* manager = media::SoundsManager::Get(); |
368 manager->Initialize(SOUND_SHUTDOWN, | 368 manager->Initialize(SOUND_SHUTDOWN, |
369 bundle.GetRawDataResource(IDR_SOUND_SHUTDOWN_WAV)); | 369 bundle.GetRawDataResource(IDR_SOUND_SHUTDOWN_WAV)); |
370 manager->Initialize( | 370 manager->Initialize( |
371 SOUND_SPOKEN_FEEDBACK_ENABLED, | 371 SOUND_SPOKEN_FEEDBACK_ENABLED, |
372 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); | 372 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); |
373 manager->Initialize( | 373 manager->Initialize( |
374 SOUND_SPOKEN_FEEDBACK_DISABLED, | 374 SOUND_SPOKEN_FEEDBACK_DISABLED, |
375 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); | 375 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); |
| 376 manager->Initialize(SOUND_PASSTHROUGH, |
| 377 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); |
| 378 manager->Initialize(SOUND_EXIT_SCREEN, |
| 379 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); |
| 380 manager->Initialize(SOUND_ENTER_SCREEN, |
| 381 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
376 } | 382 } |
377 | 383 |
378 AccessibilityManager::~AccessibilityManager() { | 384 AccessibilityManager::~AccessibilityManager() { |
379 CHECK(this == g_accessibility_manager); | 385 CHECK(this == g_accessibility_manager); |
380 AccessibilityStatusEventDetails details( | 386 AccessibilityStatusEventDetails details( |
381 ACCESSIBILITY_MANAGER_SHUTDOWN, | 387 ACCESSIBILITY_MANAGER_SHUTDOWN, |
382 false, | 388 false, |
383 ash::A11Y_NOTIFICATION_NONE); | 389 ash::A11Y_NOTIFICATION_NONE); |
384 NotifyAccessibilityStatusChanged(details); | 390 NotifyAccessibilityStatusChanged(details); |
385 input_method::InputMethodManager::Get()->RemoveObserver(this); | 391 input_method::InputMethodManager::Get()->RemoveObserver(this); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (!IsSpokenFeedbackEnabled()) | 692 if (!IsSpokenFeedbackEnabled()) |
687 return; | 693 return; |
688 | 694 |
689 // If the system locale changes and spoken feedback is enabled, | 695 // If the system locale changes and spoken feedback is enabled, |
690 // reload ChromeVox so that it switches its internal translations | 696 // reload ChromeVox so that it switches its internal translations |
691 // to the new language. | 697 // to the new language. |
692 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); | 698 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); |
693 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); | 699 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); |
694 } | 700 } |
695 | 701 |
| 702 void AccessibilityManager::PlayEarcon(int sound_key) { |
| 703 DCHECK(sound_key < chromeos::SOUND_COUNT); |
| 704 ash::PlaySystemSoundIfSpokenFeedback(sound_key); |
| 705 } |
| 706 |
696 bool AccessibilityManager::IsHighContrastEnabled() { | 707 bool AccessibilityManager::IsHighContrastEnabled() { |
697 return high_contrast_enabled_; | 708 return high_contrast_enabled_; |
698 } | 709 } |
699 | 710 |
700 void AccessibilityManager::EnableAutoclick(bool enabled) { | 711 void AccessibilityManager::EnableAutoclick(bool enabled) { |
701 if (!profile_) | 712 if (!profile_) |
702 return; | 713 return; |
703 | 714 |
704 PrefService* pref_service = profile_->GetPrefs(); | 715 PrefService* pref_service = profile_->GetPrefs(); |
705 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); | 716 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 chrome_vox_loaded_on_lock_screen_; | 1116 chrome_vox_loaded_on_lock_screen_; |
1106 } | 1117 } |
1107 | 1118 |
1108 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1119 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
1109 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1120 // Do any teardown work needed immediately after ChromeVox actually unloads. |
1110 if (system_sounds_enabled_) | 1121 if (system_sounds_enabled_) |
1111 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1122 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
1112 } | 1123 } |
1113 | 1124 |
1114 } // namespace chromeos | 1125 } // namespace chromeos |
OLD | NEW |