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

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: Address last nits 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
547 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED && 553 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED &&
548 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) { 554 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) {
549 return false; 555 return false;
550 } 556 }
551 return media::SoundsManager::Get()->Play(sound_key); 557 return media::SoundsManager::Get()->Play(sound_key);
552 } 558 }
553 559
560 bool AccessibilityManager::PlaySpokenFeedbackToggleCountdown(int tick_count) {
561 return media::SoundsManager::Get()->Play(
562 tick_count % 2 ? SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH
563 : SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW);
564 }
565
554 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { 566 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) {
555 extensions::EventRouter* event_router = 567 extensions::EventRouter* event_router =
556 extensions::EventRouter::Get(profile()); 568 extensions::EventRouter::Get(profile());
557 CHECK(event_router); 569 CHECK(event_router);
558 570
559 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); 571 std::unique_ptr<base::ListValue> event_args(new base::ListValue());
560 event_args->AppendString(ui::ToString(gesture)); 572 event_args->AppendString(ui::ToString(gesture));
561 std::unique_ptr<extensions::Event> event(new extensions::Event( 573 std::unique_ptr<extensions::Event> event(new extensions::Event(
562 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE, 574 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE,
563 extensions::api::accessibility_private::OnAccessibilityGesture:: 575 extensions::api::accessibility_private::OnAccessibilityGesture::
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 content::BrowserContext* context) { 1370 content::BrowserContext* context) {
1359 keyboard_listener_extension_id_ = id; 1371 keyboard_listener_extension_id_ = id;
1360 1372
1361 extensions::ExtensionRegistry* registry = 1373 extensions::ExtensionRegistry* registry =
1362 extensions::ExtensionRegistry::Get(context); 1374 extensions::ExtensionRegistry::Get(context);
1363 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1375 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1364 extension_registry_observer_.Add(registry); 1376 extension_registry_observer_.Add(registry);
1365 } 1377 }
1366 1378
1367 } // namespace chromeos 1379 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698