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