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

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

Issue 2476843003: Toggle spoken feedback if two fingers are held down. (Closed)
Patch Set: Created 4 years, 1 month 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); 288 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV));
289 manager->Initialize( 289 manager->Initialize(
290 SOUND_SPOKEN_FEEDBACK_DISABLED, 290 SOUND_SPOKEN_FEEDBACK_DISABLED,
291 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); 291 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV));
292 manager->Initialize(SOUND_PASSTHROUGH, 292 manager->Initialize(SOUND_PASSTHROUGH,
293 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); 293 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV));
294 manager->Initialize(SOUND_EXIT_SCREEN, 294 manager->Initialize(SOUND_EXIT_SCREEN,
295 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); 295 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV));
296 manager->Initialize(SOUND_ENTER_SCREEN, 296 manager->Initialize(SOUND_ENTER_SCREEN,
297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); 297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV));
298 manager->Initialize(SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH,
299 bundle.GetRawDataResource(
300 IDR_SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH_WAV));
301 manager->Initialize(SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW,
302 bundle.GetRawDataResource(
303 IDR_SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW_WAV));
298 304
299 base::FilePath resources_path; 305 base::FilePath resources_path;
300 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) 306 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path))
301 NOTREACHED(); 307 NOTREACHED();
302 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( 308 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader(
303 extension_misc::kChromeVoxExtensionId, 309 extension_misc::kChromeVoxExtensionId,
304 resources_path.Append(extension_misc::kChromeVoxExtensionPath), 310 resources_path.Append(extension_misc::kChromeVoxExtensionPath),
305 base::Bind(&AccessibilityManager::PostUnloadChromeVox, 311 base::Bind(&AccessibilityManager::PostUnloadChromeVox,
306 weak_ptr_factory_.GetWeakPtr()))); 312 weak_ptr_factory_.GetWeakPtr())));
307 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( 313 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // If the system locale changes and spoken feedback is enabled, 541 // If the system locale changes and spoken feedback is enabled,
536 // reload ChromeVox so that it switches its internal translations 542 // reload ChromeVox so that it switches its internal translations
537 // to the new language. 543 // to the new language.
538 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); 544 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE);
539 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); 545 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE);
540 } 546 }
541 547
542 bool AccessibilityManager::PlayEarcon(int sound_key, PlaySoundOption option) { 548 bool AccessibilityManager::PlayEarcon(int sound_key, PlaySoundOption option) {
543 DCHECK(sound_key < chromeos::SOUND_COUNT); 549 DCHECK(sound_key < chromeos::SOUND_COUNT);
544 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); 550 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
545 if (cl->HasSwitch(kAshDisableSystemSounds)) 551 if (cl->HasSwitch(kAshDisableSystemSounds)) {
546 return false; 552 return false;
553 }
oshima 2016/11/08 18:14:43 nuke {}
dmazzoni 2016/11/08 20:43:47 Done.
547 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED && 554 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED &&
548 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) { 555 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) {
549 return false; 556 return false;
550 } 557 }
551 return media::SoundsManager::Get()->Play(sound_key); 558 return media::SoundsManager::Get()->Play(sound_key);
552 } 559 }
553 560
561 bool AccessibilityManager::PlaySpokenFeedbackToggleCountdown(int tick_count) {
562 // When the user holds down two fingers on a touch screen, play
563 // alternating high and low tick sounds to warn the user that something
564 // is going to happen, until the elapsed time has passed to enable
565 // spoken feedback.
oshima 2016/11/08 18:14:43 and consolidate this with the comment in the heade
dmazzoni 2016/11/08 20:43:47 Removed this one, I'll just leave the main comment
566 return media::SoundsManager::Get()->Play(
567 tick_count % 2 ? SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH
568 : SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW);
569 }
570
554 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { 571 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) {
555 extensions::EventRouter* event_router = 572 extensions::EventRouter* event_router =
556 extensions::EventRouter::Get(profile()); 573 extensions::EventRouter::Get(profile());
557 CHECK(event_router); 574 CHECK(event_router);
558 575
559 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); 576 std::unique_ptr<base::ListValue> event_args(new base::ListValue());
560 event_args->AppendString(ui::ToString(gesture)); 577 event_args->AppendString(ui::ToString(gesture));
561 std::unique_ptr<extensions::Event> event(new extensions::Event( 578 std::unique_ptr<extensions::Event> event(new extensions::Event(
562 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE, 579 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE,
563 extensions::api::accessibility_private::OnAccessibilityGesture:: 580 extensions::api::accessibility_private::OnAccessibilityGesture::
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 content::BrowserContext* context) { 1375 content::BrowserContext* context) {
1359 keyboard_listener_extension_id_ = id; 1376 keyboard_listener_extension_id_ = id;
1360 1377
1361 extensions::ExtensionRegistry* registry = 1378 extensions::ExtensionRegistry* registry =
1362 extensions::ExtensionRegistry::Get(context); 1379 extensions::ExtensionRegistry::Get(context);
1363 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1380 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1364 extension_registry_observer_.Add(registry); 1381 extension_registry_observer_.Add(registry);
1365 } 1382 }
1366 1383
1367 } // namespace chromeos 1384 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698