Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 410783002: Corner Passthrough for Accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@side-gestures
Patch Set: Fixed some rebase quirks Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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));
379 manager->Initialize(SOUND_EXIT_SCREEN,
380 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV));
381 manager->Initialize(SOUND_ENTER_SCREEN,
382 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV));
377 } 383 }
378 384
379 AccessibilityManager::~AccessibilityManager() { 385 AccessibilityManager::~AccessibilityManager() {
380 CHECK(this == g_accessibility_manager); 386 CHECK(this == g_accessibility_manager);
381 AccessibilityStatusEventDetails details( 387 AccessibilityStatusEventDetails details(
382 ACCESSIBILITY_MANAGER_SHUTDOWN, 388 ACCESSIBILITY_MANAGER_SHUTDOWN,
383 false, 389 false,
384 ash::A11Y_NOTIFICATION_NONE); 390 ash::A11Y_NOTIFICATION_NONE);
385 NotifyAccessibilityStatusChanged(details); 391 NotifyAccessibilityStatusChanged(details);
386 input_method::InputMethodManager::Get()->RemoveObserver(this); 392 input_method::InputMethodManager::Get()->RemoveObserver(this);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 if (!IsSpokenFeedbackEnabled()) 693 if (!IsSpokenFeedbackEnabled())
688 return; 694 return;
689 695
690 // If the system locale changes and spoken feedback is enabled, 696 // If the system locale changes and spoken feedback is enabled,
691 // reload ChromeVox so that it switches its internal translations 697 // reload ChromeVox so that it switches its internal translations
692 // to the new language. 698 // to the new language.
693 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); 699 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE);
694 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); 700 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE);
695 } 701 }
696 702
703 void AccessibilityManager::PlayEarcon(int 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698