| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); | 289 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_ENABLED_WAV)); |
| 290 manager->Initialize( | 290 manager->Initialize( |
| 291 SOUND_SPOKEN_FEEDBACK_DISABLED, | 291 SOUND_SPOKEN_FEEDBACK_DISABLED, |
| 292 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); | 292 bundle.GetRawDataResource(IDR_SOUND_SPOKEN_FEEDBACK_DISABLED_WAV)); |
| 293 manager->Initialize(SOUND_PASSTHROUGH, | 293 manager->Initialize(SOUND_PASSTHROUGH, |
| 294 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); | 294 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); |
| 295 manager->Initialize(SOUND_EXIT_SCREEN, | 295 manager->Initialize(SOUND_EXIT_SCREEN, |
| 296 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); | 296 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); |
| 297 manager->Initialize(SOUND_ENTER_SCREEN, | 297 manager->Initialize(SOUND_ENTER_SCREEN, |
| 298 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); | 298 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
| 299 manager->Initialize(SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH, | |
| 300 bundle.GetRawDataResource( | |
| 301 IDR_SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH_WAV)); | |
| 302 manager->Initialize(SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW, | |
| 303 bundle.GetRawDataResource( | |
| 304 IDR_SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW_WAV)); | |
| 305 | 299 |
| 306 base::FilePath resources_path; | 300 base::FilePath resources_path; |
| 307 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) | 301 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) |
| 308 NOTREACHED(); | 302 NOTREACHED(); |
| 309 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( | 303 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| 310 extension_misc::kChromeVoxExtensionId, | 304 extension_misc::kChromeVoxExtensionId, |
| 311 resources_path.Append(extension_misc::kChromeVoxExtensionPath), | 305 resources_path.Append(extension_misc::kChromeVoxExtensionPath), |
| 312 base::Bind(&AccessibilityManager::PostUnloadChromeVox, | 306 base::Bind(&AccessibilityManager::PostUnloadChromeVox, |
| 313 weak_ptr_factory_.GetWeakPtr()))); | 307 weak_ptr_factory_.GetWeakPtr()))); |
| 314 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( | 308 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 545 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 552 if (cl->HasSwitch(kAshDisableSystemSounds)) | 546 if (cl->HasSwitch(kAshDisableSystemSounds)) |
| 553 return false; | 547 return false; |
| 554 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED && | 548 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED && |
| 555 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) { | 549 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) { |
| 556 return false; | 550 return false; |
| 557 } | 551 } |
| 558 return media::SoundsManager::Get()->Play(sound_key); | 552 return media::SoundsManager::Get()->Play(sound_key); |
| 559 } | 553 } |
| 560 | 554 |
| 561 bool AccessibilityManager::PlaySpokenFeedbackToggleCountdown(int tick_count) { | |
| 562 return media::SoundsManager::Get()->Play( | |
| 563 tick_count % 2 ? SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_HIGH | |
| 564 : SOUND_SPOKEN_FEEDBACK_TOGGLE_COUNTDOWN_LOW); | |
| 565 } | |
| 566 | |
| 567 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { | 555 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { |
| 568 extensions::EventRouter* event_router = | 556 extensions::EventRouter* event_router = |
| 569 extensions::EventRouter::Get(profile()); | 557 extensions::EventRouter::Get(profile()); |
| 570 CHECK(event_router); | 558 CHECK(event_router); |
| 571 | 559 |
| 572 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 560 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
| 573 event_args->AppendString(ui::ToString(gesture)); | 561 event_args->AppendString(ui::ToString(gesture)); |
| 574 std::unique_ptr<extensions::Event> event(new extensions::Event( | 562 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 575 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE, | 563 extensions::events::ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE, |
| 576 extensions::api::accessibility_private::OnAccessibilityGesture:: | 564 extensions::api::accessibility_private::OnAccessibilityGesture:: |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 content::BrowserContext* context) { | 1361 content::BrowserContext* context) { |
| 1374 keyboard_listener_extension_id_ = id; | 1362 keyboard_listener_extension_id_ = id; |
| 1375 | 1363 |
| 1376 extensions::ExtensionRegistry* registry = | 1364 extensions::ExtensionRegistry* registry = |
| 1377 extensions::ExtensionRegistry::Get(context); | 1365 extensions::ExtensionRegistry::Get(context); |
| 1378 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1366 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1379 extension_registry_observer_.Add(registry); | 1367 extension_registry_observer_.Add(registry); |
| 1380 } | 1368 } |
| 1381 | 1369 |
| 1382 } // namespace chromeos | 1370 } // namespace chromeos |
| OLD | NEW |