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" | |
8 #include "ash/autoclick/autoclick_controller.h" | |
9 #include "ash/high_contrast/high_contrast_controller.h" | |
10 #include "ash/metrics/user_metrics_recorder.h" | |
11 #include "ash/session/session_state_delegate.h" | |
12 #include "ash/shell.h" | |
13 #include "ash/sticky_keys/sticky_keys_controller.h" | |
14 #include "ash/system/tray/system_tray_notifier.h" | |
15 #include "base/callback.h" | 7 #include "base/callback.h" |
16 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
17 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
19 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
20 #include "base/path_service.h" | 12 #include "base/path_service.h" |
21 #include "base/prefs/pref_member.h" | 13 #include "base/prefs/pref_member.h" |
22 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
23 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
24 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
25 #include "base/time/time.h" | 17 #include "base/time/time.h" |
26 #include "base/values.h" | 18 #include "base/values.h" |
27 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 19 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
28 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | |
31 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 22 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
32 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 23 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
33 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
34 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 25 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
35 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
36 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" | 27 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
37 #include "chrome/browser/extensions/component_loader.h" | 28 #include "chrome/browser/extensions/component_loader.h" |
38 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
39 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 19 matching lines...) Expand all Loading... |
60 #include "extensions/browser/extension_system.h" | 51 #include "extensions/browser/extension_system.h" |
61 #include "extensions/browser/file_reader.h" | 52 #include "extensions/browser/file_reader.h" |
62 #include "extensions/common/extension.h" | 53 #include "extensions/common/extension.h" |
63 #include "extensions/common/extension_messages.h" | 54 #include "extensions/common/extension_messages.h" |
64 #include "extensions/common/extension_resource.h" | 55 #include "extensions/common/extension_resource.h" |
65 #include "media/audio/sounds/sounds_manager.h" | 56 #include "media/audio/sounds/sounds_manager.h" |
66 #include "ui/base/resource/resource_bundle.h" | 57 #include "ui/base/resource/resource_bundle.h" |
67 #include "ui/keyboard/keyboard_controller.h" | 58 #include "ui/keyboard/keyboard_controller.h" |
68 #include "ui/keyboard/keyboard_util.h" | 59 #include "ui/keyboard/keyboard_util.h" |
69 | 60 |
| 61 #if !defined(USE_ATHENA) |
| 62 #include "ash/audio/sounds.h" |
| 63 #include "ash/autoclick/autoclick_controller.h" |
| 64 #include "ash/high_contrast/high_contrast_controller.h" |
| 65 #include "ash/metrics/user_metrics_recorder.h" |
| 66 #include "ash/session/session_state_delegate.h" |
| 67 #include "ash/shell.h" |
| 68 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 69 #include "ash/system/tray/system_tray_notifier.h" |
| 70 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 71 #endif |
| 72 |
70 using content::BrowserThread; | 73 using content::BrowserThread; |
71 using content::RenderViewHost; | 74 using content::RenderViewHost; |
72 using extensions::api::braille_display_private::BrailleController; | 75 using extensions::api::braille_display_private::BrailleController; |
73 using extensions::api::braille_display_private::DisplayState; | 76 using extensions::api::braille_display_private::DisplayState; |
74 using extensions::api::braille_display_private::KeyEvent; | 77 using extensions::api::braille_display_private::KeyEvent; |
75 | 78 |
76 namespace chromeos { | 79 namespace chromeos { |
77 | 80 |
78 namespace { | 81 namespace { |
79 | 82 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 242 } |
240 | 243 |
241 } // namespace | 244 } // namespace |
242 | 245 |
243 /////////////////////////////////////////////////////////////////////////////// | 246 /////////////////////////////////////////////////////////////////////////////// |
244 // AccessibilityStatusEventDetails | 247 // AccessibilityStatusEventDetails |
245 | 248 |
246 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 249 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
247 AccessibilityNotificationType notification_type, | 250 AccessibilityNotificationType notification_type, |
248 bool enabled, | 251 bool enabled, |
249 ash::AccessibilityNotificationVisibility notify) | 252 ui::AccessibilityNotificationVisibility notify) |
250 : notification_type(notification_type), | 253 : notification_type(notification_type), |
251 enabled(enabled), | 254 enabled(enabled), |
252 magnifier_type(ash::kDefaultMagnifierType), | 255 magnifier_type(ui::kDefaultMagnifierType), |
253 notify(notify) {} | 256 notify(notify) {} |
254 | 257 |
255 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 258 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
256 AccessibilityNotificationType notification_type, | 259 AccessibilityNotificationType notification_type, |
257 bool enabled, | 260 bool enabled, |
258 ash::MagnifierType magnifier_type, | 261 ui::MagnifierType magnifier_type, |
259 ash::AccessibilityNotificationVisibility notify) | 262 ui::AccessibilityNotificationVisibility notify) |
260 : notification_type(notification_type), | 263 : notification_type(notification_type), |
261 enabled(enabled), | 264 enabled(enabled), |
262 magnifier_type(magnifier_type), | 265 magnifier_type(magnifier_type), |
263 notify(notify) {} | 266 notify(notify) {} |
264 | 267 |
265 /////////////////////////////////////////////////////////////////////////////// | 268 /////////////////////////////////////////////////////////////////////////////// |
266 // | 269 // |
267 // AccessibilityManager::PrefHandler | 270 // AccessibilityManager::PrefHandler |
268 | 271 |
269 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) | 272 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), | 335 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), |
333 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), | 336 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), |
334 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), | 337 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), |
335 virtual_keyboard_pref_handler_( | 338 virtual_keyboard_pref_handler_( |
336 prefs::kAccessibilityVirtualKeyboardEnabled), | 339 prefs::kAccessibilityVirtualKeyboardEnabled), |
337 large_cursor_enabled_(false), | 340 large_cursor_enabled_(false), |
338 sticky_keys_enabled_(false), | 341 sticky_keys_enabled_(false), |
339 spoken_feedback_enabled_(false), | 342 spoken_feedback_enabled_(false), |
340 high_contrast_enabled_(false), | 343 high_contrast_enabled_(false), |
341 autoclick_enabled_(false), | 344 autoclick_enabled_(false), |
| 345 #if defined(USE_ATHENA) |
| 346 autoclick_delay_ms_(400), |
| 347 #else |
342 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), | 348 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
| 349 #endif |
343 virtual_keyboard_enabled_(false), | 350 virtual_keyboard_enabled_(false), |
344 spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE), | 351 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), |
345 should_speak_chrome_vox_announcements_on_user_screen_(true), | 352 should_speak_chrome_vox_announcements_on_user_screen_(true), |
346 system_sounds_enabled_(false), | 353 system_sounds_enabled_(false), |
347 braille_display_connected_(false), | 354 braille_display_connected_(false), |
348 scoped_braille_observer_(this), | 355 scoped_braille_observer_(this), |
349 braille_ime_current_(false), | 356 braille_ime_current_(false), |
350 weak_ptr_factory_(this) { | 357 weak_ptr_factory_(this) { |
351 notification_registrar_.Add(this, | 358 notification_registrar_.Add(this, |
352 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 359 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
353 content::NotificationService::AllSources()); | 360 content::NotificationService::AllSources()); |
354 notification_registrar_.Add(this, | 361 notification_registrar_.Add(this, |
(...skipping 24 matching lines...) Expand all Loading... |
379 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); | 386 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); |
380 manager->Initialize(SOUND_ENTER_SCREEN, | 387 manager->Initialize(SOUND_ENTER_SCREEN, |
381 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); | 388 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
382 } | 389 } |
383 | 390 |
384 AccessibilityManager::~AccessibilityManager() { | 391 AccessibilityManager::~AccessibilityManager() { |
385 CHECK(this == g_accessibility_manager); | 392 CHECK(this == g_accessibility_manager); |
386 AccessibilityStatusEventDetails details( | 393 AccessibilityStatusEventDetails details( |
387 ACCESSIBILITY_MANAGER_SHUTDOWN, | 394 ACCESSIBILITY_MANAGER_SHUTDOWN, |
388 false, | 395 false, |
389 ash::A11Y_NOTIFICATION_NONE); | 396 ui::A11Y_NOTIFICATION_NONE); |
390 NotifyAccessibilityStatusChanged(details); | 397 NotifyAccessibilityStatusChanged(details); |
391 input_method::InputMethodManager::Get()->RemoveObserver(this); | 398 input_method::InputMethodManager::Get()->RemoveObserver(this); |
392 } | 399 } |
393 | 400 |
394 bool AccessibilityManager::ShouldShowAccessibilityMenu() { | 401 bool AccessibilityManager::ShouldShowAccessibilityMenu() { |
395 // If any of the loaded profiles has an accessibility feature turned on - or | 402 // If any of the loaded profiles has an accessibility feature turned on - or |
396 // enforced to always show the menu - we return true to show the menu. | 403 // enforced to always show the menu - we return true to show the menu. |
397 std::vector<Profile*> profiles = | 404 std::vector<Profile*> profiles = |
398 g_browser_process->profile_manager()->GetLoadedProfiles(); | 405 g_browser_process->profile_manager()->GetLoadedProfiles(); |
399 for (std::vector<Profile*>::iterator it = profiles.begin(); | 406 for (std::vector<Profile*>::iterator it = profiles.begin(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); | 452 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); |
446 | 453 |
447 if (large_cursor_enabled_ == enabled) | 454 if (large_cursor_enabled_ == enabled) |
448 return; | 455 return; |
449 | 456 |
450 large_cursor_enabled_ = enabled; | 457 large_cursor_enabled_ = enabled; |
451 | 458 |
452 AccessibilityStatusEventDetails details( | 459 AccessibilityStatusEventDetails details( |
453 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, | 460 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, |
454 enabled, | 461 enabled, |
455 ash::A11Y_NOTIFICATION_NONE); | 462 ui::A11Y_NOTIFICATION_NONE); |
456 | 463 |
457 NotifyAccessibilityStatusChanged(details); | 464 NotifyAccessibilityStatusChanged(details); |
458 #if !defined(USE_ATHENA) | 465 #if !defined(USE_ATHENA) |
459 // crbug.com/408733 (and for all USE_ATHENA in this file) | 466 // crbug.com/408733 (and for all USE_ATHENA in this file) |
460 | 467 |
461 #if defined(USE_ASH) | 468 #if defined(USE_ASH) |
462 // Large cursor is implemented only in ash. | 469 // Large cursor is implemented only in ash. |
463 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( | 470 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( |
464 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); | 471 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); |
465 #endif | 472 #endif |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 return; | 511 return; |
505 | 512 |
506 sticky_keys_enabled_ = enabled; | 513 sticky_keys_enabled_ = enabled; |
507 #if defined(USE_ASH) && !defined(USE_ATHENA) | 514 #if defined(USE_ASH) && !defined(USE_ATHENA) |
508 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); | 515 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); |
509 #endif | 516 #endif |
510 } | 517 } |
511 | 518 |
512 void AccessibilityManager::EnableSpokenFeedback( | 519 void AccessibilityManager::EnableSpokenFeedback( |
513 bool enabled, | 520 bool enabled, |
514 ash::AccessibilityNotificationVisibility notify) { | 521 ui::AccessibilityNotificationVisibility notify) { |
515 if (!profile_) | 522 if (!profile_) |
516 return; | 523 return; |
517 #if !defined(USE_ATHENA) | 524 #if !defined(USE_ATHENA) |
518 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 525 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
519 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK | 526 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK |
520 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); | 527 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); |
521 #endif | 528 #endif |
522 | 529 |
523 spoken_feedback_notification_ = notify; | 530 spoken_feedback_notification_ = notify; |
524 | 531 |
525 PrefService* pref_service = profile_->GetPrefs(); | 532 PrefService* pref_service = profile_->GetPrefs(); |
526 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); | 533 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); |
527 pref_service->CommitPendingWrite(); | 534 pref_service->CommitPendingWrite(); |
528 | 535 |
529 spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE; | 536 spoken_feedback_notification_ = ui::A11Y_NOTIFICATION_NONE; |
530 } | 537 } |
531 | 538 |
532 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { | 539 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
533 if (!profile_) | 540 if (!profile_) |
534 return; | 541 return; |
535 | 542 |
536 const bool enabled = profile_->GetPrefs()->GetBoolean( | 543 const bool enabled = profile_->GetPrefs()->GetBoolean( |
537 prefs::kAccessibilitySpokenFeedbackEnabled); | 544 prefs::kAccessibilitySpokenFeedbackEnabled); |
538 | 545 |
539 if (spoken_feedback_enabled_ == enabled) | 546 if (spoken_feedback_enabled_ == enabled) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 Profile* signin_profile = ProfileHelper::GetSigninProfile(); | 646 Profile* signin_profile = ProfileHelper::GetSigninProfile(); |
640 UnloadChromeVoxExtension(signin_profile); | 647 UnloadChromeVoxExtension(signin_profile); |
641 chrome_vox_loaded_on_lock_screen_ = false; | 648 chrome_vox_loaded_on_lock_screen_ = false; |
642 } | 649 } |
643 | 650 |
644 bool AccessibilityManager::IsSpokenFeedbackEnabled() { | 651 bool AccessibilityManager::IsSpokenFeedbackEnabled() { |
645 return spoken_feedback_enabled_; | 652 return spoken_feedback_enabled_; |
646 } | 653 } |
647 | 654 |
648 void AccessibilityManager::ToggleSpokenFeedback( | 655 void AccessibilityManager::ToggleSpokenFeedback( |
649 ash::AccessibilityNotificationVisibility notify) { | 656 ui::AccessibilityNotificationVisibility notify) { |
650 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); | 657 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); |
651 } | 658 } |
652 | 659 |
653 void AccessibilityManager::EnableHighContrast(bool enabled) { | 660 void AccessibilityManager::EnableHighContrast(bool enabled) { |
654 if (!profile_) | 661 if (!profile_) |
655 return; | 662 return; |
656 | 663 |
657 PrefService* pref_service = profile_->GetPrefs(); | 664 PrefService* pref_service = profile_->GetPrefs(); |
658 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); | 665 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); |
659 pref_service->CommitPendingWrite(); | 666 pref_service->CommitPendingWrite(); |
660 } | 667 } |
661 | 668 |
662 void AccessibilityManager::UpdateHighContrastFromPref() { | 669 void AccessibilityManager::UpdateHighContrastFromPref() { |
663 if (!profile_) | 670 if (!profile_) |
664 return; | 671 return; |
665 | 672 |
666 const bool enabled = profile_->GetPrefs()->GetBoolean( | 673 const bool enabled = profile_->GetPrefs()->GetBoolean( |
667 prefs::kAccessibilityHighContrastEnabled); | 674 prefs::kAccessibilityHighContrastEnabled); |
668 | 675 |
669 if (high_contrast_enabled_ == enabled) | 676 if (high_contrast_enabled_ == enabled) |
670 return; | 677 return; |
671 | 678 |
672 high_contrast_enabled_ = enabled; | 679 high_contrast_enabled_ = enabled; |
673 | 680 |
674 AccessibilityStatusEventDetails details( | 681 AccessibilityStatusEventDetails details( |
675 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | 682 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, |
676 enabled, | 683 enabled, |
677 ash::A11Y_NOTIFICATION_NONE); | 684 ui::A11Y_NOTIFICATION_NONE); |
678 | 685 |
679 NotifyAccessibilityStatusChanged(details); | 686 NotifyAccessibilityStatusChanged(details); |
680 | 687 |
681 #if !defined(USE_ATHENA) | 688 #if !defined(USE_ATHENA) |
682 | 689 |
683 #if defined(USE_ASH) | 690 #if defined(USE_ASH) |
684 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); | 691 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); |
685 #endif | 692 #endif |
686 | 693 |
687 #if defined(OS_CHROMEOS) | 694 #if defined(OS_CHROMEOS) |
688 ash::Shell::GetInstance()->SetCursorCompositingEnabled( | 695 ash::Shell::GetInstance()->SetCursorCompositingEnabled( |
689 ShouldEnableCursorCompositing()); | 696 ShouldEnableCursorCompositing()); |
690 #endif | 697 #endif |
691 | 698 |
692 #endif | 699 #endif |
693 } | 700 } |
694 | 701 |
695 void AccessibilityManager::OnLocaleChanged() { | 702 void AccessibilityManager::OnLocaleChanged() { |
696 if (!profile_) | 703 if (!profile_) |
697 return; | 704 return; |
698 | 705 |
699 if (!IsSpokenFeedbackEnabled()) | 706 if (!IsSpokenFeedbackEnabled()) |
700 return; | 707 return; |
701 | 708 |
702 // If the system locale changes and spoken feedback is enabled, | 709 // If the system locale changes and spoken feedback is enabled, |
703 // reload ChromeVox so that it switches its internal translations | 710 // reload ChromeVox so that it switches its internal translations |
704 // to the new language. | 711 // to the new language. |
705 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); | 712 EnableSpokenFeedback(false, ui::A11Y_NOTIFICATION_NONE); |
706 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); | 713 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_NONE); |
707 } | 714 } |
708 | 715 |
709 void AccessibilityManager::PlayEarcon(int sound_key) { | 716 void AccessibilityManager::PlayEarcon(int sound_key) { |
| 717 #if !defined(USE_ATHENA) |
710 DCHECK(sound_key < chromeos::SOUND_COUNT); | 718 DCHECK(sound_key < chromeos::SOUND_COUNT); |
711 ash::PlaySystemSoundIfSpokenFeedback(sound_key); | 719 ash::PlaySystemSoundIfSpokenFeedback(sound_key); |
| 720 #endif |
712 } | 721 } |
713 | 722 |
714 bool AccessibilityManager::IsHighContrastEnabled() { | 723 bool AccessibilityManager::IsHighContrastEnabled() { |
715 return high_contrast_enabled_; | 724 return high_contrast_enabled_; |
716 } | 725 } |
717 | 726 |
718 void AccessibilityManager::EnableAutoclick(bool enabled) { | 727 void AccessibilityManager::EnableAutoclick(bool enabled) { |
719 if (!profile_) | 728 if (!profile_) |
720 return; | 729 return; |
721 | 730 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 const bool enabled = profile_->GetPrefs()->GetBoolean( | 798 const bool enabled = profile_->GetPrefs()->GetBoolean( |
790 prefs::kAccessibilityVirtualKeyboardEnabled); | 799 prefs::kAccessibilityVirtualKeyboardEnabled); |
791 | 800 |
792 if (virtual_keyboard_enabled_ == enabled) | 801 if (virtual_keyboard_enabled_ == enabled) |
793 return; | 802 return; |
794 virtual_keyboard_enabled_ = enabled; | 803 virtual_keyboard_enabled_ = enabled; |
795 | 804 |
796 AccessibilityStatusEventDetails details( | 805 AccessibilityStatusEventDetails details( |
797 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | 806 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
798 enabled, | 807 enabled, |
799 ash::A11Y_NOTIFICATION_NONE); | 808 ui::A11Y_NOTIFICATION_NONE); |
800 | 809 |
801 NotifyAccessibilityStatusChanged(details); | 810 NotifyAccessibilityStatusChanged(details); |
802 | 811 |
803 #if defined(USE_ASH) && !defined(USE_ATHENA) | 812 #if defined(USE_ASH) && !defined(USE_ATHENA) |
804 keyboard::SetAccessibilityKeyboardEnabled(enabled); | 813 keyboard::SetAccessibilityKeyboardEnabled(enabled); |
805 // Note that there are two versions of the on-screen keyboard. A full layout | 814 // Note that there are two versions of the on-screen keyboard. A full layout |
806 // is provided for accessibility, which includes sticky modifier keys to | 815 // is provided for accessibility, which includes sticky modifier keys to |
807 // enable typing of hotkeys. A compact version is used in touchview mode | 816 // enable typing of hotkeys. A compact version is used in touchview mode |
808 // to provide a layout with larger keys to facilitate touch typing. In the | 817 // to provide a layout with larger keys to facilitate touch typing. In the |
809 // event that the a11y keyboard is being disabled, an on-screen keyboard might | 818 // event that the a11y keyboard is being disabled, an on-screen keyboard might |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 UpdateBrailleImeState(); | 956 UpdateBrailleImeState(); |
948 UpdateLargeCursorFromPref(); | 957 UpdateLargeCursorFromPref(); |
949 UpdateStickyKeysFromPref(); | 958 UpdateStickyKeysFromPref(); |
950 UpdateSpokenFeedbackFromPref(); | 959 UpdateSpokenFeedbackFromPref(); |
951 UpdateHighContrastFromPref(); | 960 UpdateHighContrastFromPref(); |
952 UpdateAutoclickFromPref(); | 961 UpdateAutoclickFromPref(); |
953 UpdateAutoclickDelayFromPref(); | 962 UpdateAutoclickDelayFromPref(); |
954 UpdateVirtualKeyboardFromPref(); | 963 UpdateVirtualKeyboardFromPref(); |
955 } | 964 } |
956 | 965 |
| 966 #if !defined(USE_ATHENA) |
957 void AccessibilityManager::ActiveUserChanged(const std::string& user_id) { | 967 void AccessibilityManager::ActiveUserChanged(const std::string& user_id) { |
958 SetProfile(ProfileManager::GetActiveUserProfile()); | 968 SetProfile(ProfileManager::GetActiveUserProfile()); |
959 } | 969 } |
| 970 #endif |
960 | 971 |
961 void AccessibilityManager::SetProfileForTest(Profile* profile) { | 972 void AccessibilityManager::SetProfileForTest(Profile* profile) { |
962 SetProfile(profile); | 973 SetProfile(profile); |
963 } | 974 } |
964 | 975 |
965 void AccessibilityManager::SetBrailleControllerForTest( | 976 void AccessibilityManager::SetBrailleControllerForTest( |
966 BrailleController* controller) { | 977 BrailleController* controller) { |
967 g_braille_controller_for_test = controller; | 978 g_braille_controller_for_test = controller; |
968 } | 979 } |
969 | 980 |
(...skipping 28 matching lines...) Expand all Loading... |
998 } | 1009 } |
999 | 1010 |
1000 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { | 1011 void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() { |
1001 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", | 1012 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback", |
1002 IsSpokenFeedbackEnabled()); | 1013 IsSpokenFeedbackEnabled()); |
1003 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", | 1014 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", |
1004 IsHighContrastEnabled()); | 1015 IsHighContrastEnabled()); |
1005 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", | 1016 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", |
1006 IsVirtualKeyboardEnabled()); | 1017 IsVirtualKeyboardEnabled()); |
1007 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); | 1018 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); |
| 1019 #if !defined(USE_ATHENA) |
1008 if (MagnificationManager::Get()) { | 1020 if (MagnificationManager::Get()) { |
1009 uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ? | 1021 uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ? |
1010 MagnificationManager::Get()->GetMagnifierType() : 0; | 1022 MagnificationManager::Get()->GetMagnifierType() : 0; |
1011 // '0' means magnifier is disabled. | 1023 // '0' means magnifier is disabled. |
1012 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", | 1024 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", |
1013 type, | 1025 type, |
1014 ash::kMaxMagnifierType + 1); | 1026 ui::kMaxMagnifierType + 1); |
1015 } | 1027 } |
| 1028 #endif |
1016 if (profile_) { | 1029 if (profile_) { |
1017 const PrefService* const prefs = profile_->GetPrefs(); | 1030 const PrefService* const prefs = profile_->GetPrefs(); |
1018 UMA_HISTOGRAM_BOOLEAN( | 1031 UMA_HISTOGRAM_BOOLEAN( |
1019 "Accessibility.CrosLargeCursor", | 1032 "Accessibility.CrosLargeCursor", |
1020 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); | 1033 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); |
1021 UMA_HISTOGRAM_BOOLEAN( | 1034 UMA_HISTOGRAM_BOOLEAN( |
1022 "Accessibility.CrosAlwaysShowA11yMenu", | 1035 "Accessibility.CrosAlwaysShowA11yMenu", |
1023 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); | 1036 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); |
1024 | 1037 |
1025 bool autoclick_enabled = | 1038 bool autoclick_enabled = |
(...skipping 25 matching lines...) Expand all Loading... |
1051 SetProfile(profile); | 1064 SetProfile(profile); |
1052 break; | 1065 break; |
1053 } | 1066 } |
1054 case chrome::NOTIFICATION_SESSION_STARTED: | 1067 case chrome::NOTIFICATION_SESSION_STARTED: |
1055 // Update |profile_| when entering a session. | 1068 // Update |profile_| when entering a session. |
1056 SetProfile(ProfileManager::GetActiveUserProfile()); | 1069 SetProfile(ProfileManager::GetActiveUserProfile()); |
1057 | 1070 |
1058 // Ensure ChromeVox makes announcements at the start of new sessions. | 1071 // Ensure ChromeVox makes announcements at the start of new sessions. |
1059 should_speak_chrome_vox_announcements_on_user_screen_ = true; | 1072 should_speak_chrome_vox_announcements_on_user_screen_ = true; |
1060 | 1073 |
| 1074 #if !defined(USE_ATHENA) |
1061 // Add a session state observer to be able to monitor session changes. | 1075 // Add a session state observer to be able to monitor session changes. |
1062 if (!session_state_observer_.get() && ash::Shell::HasInstance()) | 1076 if (!session_state_observer_.get() && ash::Shell::HasInstance()) |
1063 session_state_observer_.reset( | 1077 session_state_observer_.reset( |
1064 new ash::ScopedSessionStateObserver(this)); | 1078 new ash::ScopedSessionStateObserver(this)); |
| 1079 #endif |
1065 break; | 1080 break; |
1066 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 1081 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
1067 // Update |profile_| when exiting a session or shutting down. | 1082 // Update |profile_| when exiting a session or shutting down. |
1068 Profile* profile = content::Source<Profile>(source).ptr(); | 1083 Profile* profile = content::Source<Profile>(source).ptr(); |
1069 if (profile_ == profile) | 1084 if (profile_ == profile) |
1070 SetProfile(NULL); | 1085 SetProfile(NULL); |
1071 break; | 1086 break; |
1072 } | 1087 } |
1073 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { | 1088 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { |
1074 bool is_screen_locked = *content::Details<bool>(details).ptr(); | 1089 bool is_screen_locked = *content::Details<bool>(details).ptr(); |
1075 if (spoken_feedback_enabled_) { | 1090 if (spoken_feedback_enabled_) { |
1076 if (is_screen_locked) | 1091 if (is_screen_locked) |
1077 LoadChromeVoxToLockScreen(base::Closure()); | 1092 LoadChromeVoxToLockScreen(base::Closure()); |
1078 // If spoken feedback was enabled, make sure it is also enabled on | 1093 // If spoken feedback was enabled, make sure it is also enabled on |
1079 // the user screen. | 1094 // the user screen. |
1080 // The status tray gets verbalized by user screen ChromeVox, so we need | 1095 // The status tray gets verbalized by user screen ChromeVox, so we need |
1081 // to load it on the user screen even if the screen is locked. | 1096 // to load it on the user screen even if the screen is locked. |
1082 LoadChromeVoxToUserScreen(base::Closure()); | 1097 LoadChromeVoxToUserScreen(base::Closure()); |
1083 } | 1098 } |
1084 break; | 1099 break; |
1085 } | 1100 } |
1086 } | 1101 } |
1087 } | 1102 } |
1088 | 1103 |
1089 void AccessibilityManager::OnBrailleDisplayStateChanged( | 1104 void AccessibilityManager::OnBrailleDisplayStateChanged( |
1090 const DisplayState& display_state) { | 1105 const DisplayState& display_state) { |
1091 braille_display_connected_ = display_state.available; | 1106 braille_display_connected_ = display_state.available; |
1092 if (braille_display_connected_) { | 1107 if (braille_display_connected_) { |
1093 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_SHOW); | 1108 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_SHOW); |
1094 } | 1109 } |
1095 UpdateBrailleImeState(); | 1110 UpdateBrailleImeState(); |
1096 | 1111 |
1097 AccessibilityStatusEventDetails details( | 1112 AccessibilityStatusEventDetails details( |
1098 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, | 1113 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, |
1099 braille_display_connected_, | 1114 braille_display_connected_, |
1100 ash::A11Y_NOTIFICATION_SHOW); | 1115 ui::A11Y_NOTIFICATION_SHOW); |
1101 NotifyAccessibilityStatusChanged(details); | 1116 NotifyAccessibilityStatusChanged(details); |
1102 } | 1117 } |
1103 | 1118 |
1104 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { | 1119 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { |
1105 // Ensure the braille IME is active on braille keyboard (dots) input. | 1120 // Ensure the braille IME is active on braille keyboard (dots) input. |
1106 if ((event.command == | 1121 if ((event.command == |
1107 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && | 1122 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && |
1108 !braille_ime_current_) { | 1123 !braille_ime_current_) { |
1109 input_method::InputMethodManager::Get() | 1124 input_method::InputMethodManager::Get() |
1110 ->GetActiveIMEState() | 1125 ->GetActiveIMEState() |
1111 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, | 1126 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, |
1112 false /* show_message */); | 1127 false /* show_message */); |
1113 } | 1128 } |
1114 } | 1129 } |
1115 | 1130 |
1116 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { | 1131 void AccessibilityManager::PostLoadChromeVox(Profile* profile) { |
| 1132 #if !defined(USE_ATHENA) |
1117 // Do any setup work needed immediately after ChromeVox actually loads. | 1133 // Do any setup work needed immediately after ChromeVox actually loads. |
1118 if (system_sounds_enabled_) | 1134 if (system_sounds_enabled_) |
1119 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); | 1135 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_ENABLED); |
| 1136 #endif |
1120 | 1137 |
1121 ExtensionAccessibilityEventRouter::GetInstance()-> | 1138 ExtensionAccessibilityEventRouter::GetInstance()-> |
1122 OnChromeVoxLoadStateChanged(profile_, | 1139 OnChromeVoxLoadStateChanged(profile_, |
1123 IsSpokenFeedbackEnabled(), | 1140 IsSpokenFeedbackEnabled(), |
1124 chrome_vox_loaded_on_lock_screen_ || | 1141 chrome_vox_loaded_on_lock_screen_ || |
1125 should_speak_chrome_vox_announcements_on_user_screen_); | 1142 should_speak_chrome_vox_announcements_on_user_screen_); |
1126 | 1143 |
1127 should_speak_chrome_vox_announcements_on_user_screen_ = | 1144 should_speak_chrome_vox_announcements_on_user_screen_ = |
1128 chrome_vox_loaded_on_lock_screen_; | 1145 chrome_vox_loaded_on_lock_screen_; |
1129 } | 1146 } |
1130 | 1147 |
1131 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { | 1148 void AccessibilityManager::PostUnloadChromeVox(Profile* profile) { |
| 1149 #if !defined(USE_ATHENA) |
1132 // Do any teardown work needed immediately after ChromeVox actually unloads. | 1150 // Do any teardown work needed immediately after ChromeVox actually unloads. |
1133 if (system_sounds_enabled_) | 1151 if (system_sounds_enabled_) |
1134 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1152 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1153 #endif |
1135 // Clear the accessibility focus ring. | 1154 // Clear the accessibility focus ring. |
1136 AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 1155 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
1137 std::vector<gfx::Rect>()); | 1156 std::vector<gfx::Rect>()); |
1138 } | 1157 } |
1139 | 1158 |
1140 } // namespace chromeos | 1159 } // namespace chromeos |
OLD | NEW |