| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "content/public/browser/render_view_host.h" | 55 #include "content/public/browser/render_view_host.h" |
| 56 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
| 57 #include "content/public/browser/web_ui.h" | 57 #include "content/public/browser/web_ui.h" |
| 58 #include "extensions/browser/extension_system.h" | 58 #include "extensions/browser/extension_system.h" |
| 59 #include "extensions/browser/file_reader.h" | 59 #include "extensions/browser/file_reader.h" |
| 60 #include "extensions/common/extension.h" | 60 #include "extensions/common/extension.h" |
| 61 #include "extensions/common/extension_messages.h" | 61 #include "extensions/common/extension_messages.h" |
| 62 #include "extensions/common/extension_resource.h" | 62 #include "extensions/common/extension_resource.h" |
| 63 #include "grit/browser_resources.h" | 63 #include "grit/browser_resources.h" |
| 64 #include "grit/generated_resources.h" | 64 #include "grit/generated_resources.h" |
| 65 #include "media/audio/sounds/sounds_manager.h" | |
| 66 #include "ui/base/l10n/l10n_util.h" | 65 #include "ui/base/l10n/l10n_util.h" |
| 67 #include "ui/base/resource/resource_bundle.h" | 66 #include "ui/base/resource/resource_bundle.h" |
| 68 #include "ui/keyboard/keyboard_controller.h" | 67 #include "ui/keyboard/keyboard_controller.h" |
| 69 #include "ui/keyboard/keyboard_util.h" | 68 #include "ui/keyboard/keyboard_util.h" |
| 70 | 69 |
| 71 using content::BrowserThread; | 70 using content::BrowserThread; |
| 72 using content::RenderViewHost; | 71 using content::RenderViewHost; |
| 73 using extensions::api::braille_display_private::BrailleController; | 72 using extensions::api::braille_display_private::BrailleController; |
| 74 using extensions::api::braille_display_private::DisplayState; | 73 using extensions::api::braille_display_private::DisplayState; |
| 75 using extensions::api::braille_display_private::KeyEvent; | 74 using extensions::api::braille_display_private::KeyEvent; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Inject ChromeVox' content scripts. | 215 // Inject ChromeVox' content scripts. |
| 217 ContentScriptLoader* loader = new ContentScriptLoader( | 216 ContentScriptLoader* loader = new ContentScriptLoader( |
| 218 extension->id(), render_view_host->GetProcess()->GetID(), | 217 extension->id(), render_view_host->GetProcess()->GetID(), |
| 219 render_view_host->GetRoutingID()); | 218 render_view_host->GetRoutingID()); |
| 220 | 219 |
| 221 const extensions::UserScriptList& content_scripts = | 220 const extensions::UserScriptList& content_scripts = |
| 222 extensions::ContentScriptsInfo::GetContentScripts(extension); | 221 extensions::ContentScriptsInfo::GetContentScripts(extension); |
| 223 for (size_t i = 0; i < content_scripts.size(); i++) { | 222 for (size_t i = 0; i < content_scripts.size(); i++) { |
| 224 const extensions::UserScript& script = content_scripts[i]; | 223 const extensions::UserScript& script = content_scripts[i]; |
| 225 for (size_t j = 0; j < script.js_scripts().size(); ++j) { | 224 for (size_t j = 0; j < script.js_scripts().size(); ++j) { |
| 226 const extensions::UserScript::File &file = script.js_scripts()[j]; | 225 const extensions::UserScript::File& file = script.js_scripts()[j]; |
| 227 extensions::ExtensionResource resource = extension->GetResource( | 226 extensions::ExtensionResource resource = extension->GetResource( |
| 228 file.relative_path()); | 227 file.relative_path()); |
| 229 loader->AppendScript(resource); | 228 loader->AppendScript(resource); |
| 230 } | 229 } |
| 231 } | 230 } |
| 232 loader->Run(); // It cleans itself up when done. | 231 loader->Run(); // It cleans itself up when done. |
| 233 } | 232 } |
| 234 | 233 |
| 235 void UnloadChromeVoxExtension(Profile* profile) { | 234 void UnloadChromeVoxExtension(Profile* profile) { |
| 236 base::FilePath path = GetChromeVoxPath(); | 235 base::FilePath path = GetChromeVoxPath(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 366 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 368 media::SoundsManager* manager = media::SoundsManager::Get(); | 367 media::SoundsManager* manager = media::SoundsManager::Get(); |
| 369 manager->Initialize(SOUND_SHUTDOWN, | 368 manager->Initialize(SOUND_SHUTDOWN, |
| 370 bundle.GetRawDataResource(IDR_SOUND_SHUTDOWN_WAV)); | 369 bundle.GetRawDataResource(IDR_SOUND_SHUTDOWN_WAV)); |
| 371 manager->Initialize( | 370 manager->Initialize( |
| 372 SOUND_SPOKEN_FEEDBACK_ENABLED, | 371 SOUND_SPOKEN_FEEDBACK_ENABLED, |
| 373 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); | 372 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); |
| 374 manager->Initialize( | 373 manager->Initialize( |
| 375 SOUND_SPOKEN_FEEDBACK_DISABLED, | 374 SOUND_SPOKEN_FEEDBACK_DISABLED, |
| 376 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)); |
| 377 } | 382 } |
| 378 | 383 |
| 379 AccessibilityManager::~AccessibilityManager() { | 384 AccessibilityManager::~AccessibilityManager() { |
| 380 CHECK(this == g_accessibility_manager); | 385 CHECK(this == g_accessibility_manager); |
| 381 AccessibilityStatusEventDetails details( | 386 AccessibilityStatusEventDetails details( |
| 382 ACCESSIBILITY_MANAGER_SHUTDOWN, | 387 ACCESSIBILITY_MANAGER_SHUTDOWN, |
| 383 false, | 388 false, |
| 384 ash::A11Y_NOTIFICATION_NONE); | 389 ash::A11Y_NOTIFICATION_NONE); |
| 385 NotifyAccessibilityStatusChanged(details); | 390 NotifyAccessibilityStatusChanged(details); |
| 386 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... |
| 687 if (!IsSpokenFeedbackEnabled()) | 692 if (!IsSpokenFeedbackEnabled()) |
| 688 return; | 693 return; |
| 689 | 694 |
| 690 // If the system locale changes and spoken feedback is enabled, | 695 // If the system locale changes and spoken feedback is enabled, |
| 691 // reload ChromeVox so that it switches its internal translations | 696 // reload ChromeVox so that it switches its internal translations |
| 692 // to the new language. | 697 // to the new language. |
| 693 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); | 698 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); |
| 694 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); | 699 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); |
| 695 } | 700 } |
| 696 | 701 |
| 702 void AccessibilityManager::PlayEarcon( |
| 703 media::SoundsManager::SoundKey sound_key) { |
| 704 DCHECK(sound_key < chromeos::SOUND_COUNT); |
| 705 ash::PlaySystemSoundIfSpokenFeedback(sound_key); |
| 706 } |
| 707 |
| 697 bool AccessibilityManager::IsHighContrastEnabled() { | 708 bool AccessibilityManager::IsHighContrastEnabled() { |
| 698 return high_contrast_enabled_; | 709 return high_contrast_enabled_; |
| 699 } | 710 } |
| 700 | 711 |
| 701 void AccessibilityManager::EnableAutoclick(bool enabled) { | 712 void AccessibilityManager::EnableAutoclick(bool enabled) { |
| 702 if (!profile_) | 713 if (!profile_) |
| 703 return; | 714 return; |
| 704 | 715 |
| 705 PrefService* pref_service = profile_->GetPrefs(); | 716 PrefService* pref_service = profile_->GetPrefs(); |
| 706 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); | 717 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_; | 1117 chrome_vox_loaded_on_lock_screen_; |
| 1107 } | 1118 } |
| 1108 | 1119 |
| 1109 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1120 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
| 1110 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1121 // Do any teardown work needed immediately after ChromeVox actually unloads. |
| 1111 if (system_sounds_enabled_) | 1122 if (system_sounds_enabled_) |
| 1112 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1123 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1113 } | 1124 } |
| 1114 | 1125 |
| 1115 } // namespace chromeos | 1126 } // namespace chromeos |
| OLD | NEW |