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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 DISALLOW_COPY_AND_ASSIGN(ChromeVoxPanelWidgetObserver); | 309 DISALLOW_COPY_AND_ASSIGN(ChromeVoxPanelWidgetObserver); |
310 }; | 310 }; |
311 | 311 |
312 /////////////////////////////////////////////////////////////////////////////// | 312 /////////////////////////////////////////////////////////////////////////////// |
313 // AccessibilityStatusEventDetails | 313 // AccessibilityStatusEventDetails |
314 | 314 |
315 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 315 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
316 AccessibilityNotificationType notification_type, | 316 AccessibilityNotificationType notification_type, |
317 bool enabled, | 317 bool enabled, |
318 ui::AccessibilityNotificationVisibility notify) | 318 ash::AccessibilityNotificationVisibility notify) |
319 : notification_type(notification_type), | 319 : notification_type(notification_type), |
320 enabled(enabled), | 320 enabled(enabled), |
321 magnifier_type(ui::kDefaultMagnifierType), | 321 magnifier_type(ash::kDefaultMagnifierType), |
322 notify(notify) {} | 322 notify(notify) {} |
323 | 323 |
324 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( | 324 AccessibilityStatusEventDetails::AccessibilityStatusEventDetails( |
325 AccessibilityNotificationType notification_type, | 325 AccessibilityNotificationType notification_type, |
326 bool enabled, | 326 bool enabled, |
327 ui::MagnifierType magnifier_type, | 327 ash::MagnifierType magnifier_type, |
328 ui::AccessibilityNotificationVisibility notify) | 328 ash::AccessibilityNotificationVisibility notify) |
329 : notification_type(notification_type), | 329 : notification_type(notification_type), |
330 enabled(enabled), | 330 enabled(enabled), |
331 magnifier_type(magnifier_type), | 331 magnifier_type(magnifier_type), |
332 notify(notify) {} | 332 notify(notify) {} |
333 | 333 |
334 /////////////////////////////////////////////////////////////////////////////// | 334 /////////////////////////////////////////////////////////////////////////////// |
335 // | 335 // |
336 // AccessibilityManager::PrefHandler | 336 // AccessibilityManager::PrefHandler |
337 | 337 |
338 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) | 338 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) |
339 : pref_path_(pref_path) {} | 339 : pref_path_(pref_path) {} |
340 | 340 |
341 AccessibilityManager::PrefHandler::~PrefHandler() {} | 341 AccessibilityManager::PrefHandler::~PrefHandler() {} |
342 | 342 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 : profile_(NULL), | 396 : profile_(NULL), |
397 chrome_vox_loaded_on_lock_screen_(false), | 397 chrome_vox_loaded_on_lock_screen_(false), |
398 chrome_vox_loaded_on_user_screen_(false), | 398 chrome_vox_loaded_on_user_screen_(false), |
399 large_cursor_pref_handler_(prefs::kAccessibilityLargeCursorEnabled), | 399 large_cursor_pref_handler_(prefs::kAccessibilityLargeCursorEnabled), |
400 spoken_feedback_pref_handler_(prefs::kAccessibilitySpokenFeedbackEnabled), | 400 spoken_feedback_pref_handler_(prefs::kAccessibilitySpokenFeedbackEnabled), |
401 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), | 401 high_contrast_pref_handler_(prefs::kAccessibilityHighContrastEnabled), |
402 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), | 402 autoclick_pref_handler_(prefs::kAccessibilityAutoclickEnabled), |
403 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), | 403 autoclick_delay_pref_handler_(prefs::kAccessibilityAutoclickDelayMs), |
404 virtual_keyboard_pref_handler_( | 404 virtual_keyboard_pref_handler_( |
405 prefs::kAccessibilityVirtualKeyboardEnabled), | 405 prefs::kAccessibilityVirtualKeyboardEnabled), |
406 mono_audio_pref_handler_( | 406 mono_audio_pref_handler_(prefs::kAccessibilityMonoAudioEnabled), |
407 prefs::kAccessibilityMonoAudioEnabled), | |
408 caret_highlight_pref_handler_(prefs::kAccessibilityCaretHighlightEnabled), | 407 caret_highlight_pref_handler_(prefs::kAccessibilityCaretHighlightEnabled), |
409 cursor_highlight_pref_handler_( | 408 cursor_highlight_pref_handler_( |
410 prefs::kAccessibilityCursorHighlightEnabled), | 409 prefs::kAccessibilityCursorHighlightEnabled), |
411 focus_highlight_pref_handler_(prefs::kAccessibilityFocusHighlightEnabled), | 410 focus_highlight_pref_handler_(prefs::kAccessibilityFocusHighlightEnabled), |
412 select_to_speak_pref_handler_(prefs::kAccessibilitySelectToSpeakEnabled), | 411 select_to_speak_pref_handler_(prefs::kAccessibilitySelectToSpeakEnabled), |
413 switch_access_pref_handler_(prefs::kAccessibilitySwitchAccessEnabled), | 412 switch_access_pref_handler_(prefs::kAccessibilitySwitchAccessEnabled), |
414 large_cursor_enabled_(false), | 413 large_cursor_enabled_(false), |
415 sticky_keys_enabled_(false), | 414 sticky_keys_enabled_(false), |
416 spoken_feedback_enabled_(false), | 415 spoken_feedback_enabled_(false), |
417 high_contrast_enabled_(false), | 416 high_contrast_enabled_(false), |
418 autoclick_enabled_(false), | 417 autoclick_enabled_(false), |
419 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), | 418 autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs), |
420 virtual_keyboard_enabled_(false), | 419 virtual_keyboard_enabled_(false), |
421 mono_audio_enabled_(false), | 420 mono_audio_enabled_(false), |
422 caret_highlight_enabled_(false), | 421 caret_highlight_enabled_(false), |
423 cursor_highlight_enabled_(false), | 422 cursor_highlight_enabled_(false), |
424 focus_highlight_enabled_(false), | 423 focus_highlight_enabled_(false), |
425 select_to_speak_enabled_(false), | 424 select_to_speak_enabled_(false), |
426 switch_access_enabled_(false), | 425 switch_access_enabled_(false), |
427 spoken_feedback_notification_(ui::A11Y_NOTIFICATION_NONE), | 426 spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE), |
428 should_speak_chrome_vox_announcements_on_user_screen_(true), | 427 should_speak_chrome_vox_announcements_on_user_screen_(true), |
429 system_sounds_enabled_(false), | 428 system_sounds_enabled_(false), |
430 braille_display_connected_(false), | 429 braille_display_connected_(false), |
431 scoped_braille_observer_(this), | 430 scoped_braille_observer_(this), |
432 braille_ime_current_(false), | 431 braille_ime_current_(false), |
433 chromevox_panel_(nullptr), | 432 chromevox_panel_(nullptr), |
434 extension_registry_observer_(this), | 433 extension_registry_observer_(this), |
435 weak_ptr_factory_(this) { | 434 weak_ptr_factory_(this) { |
436 notification_registrar_.Add(this, | 435 notification_registrar_.Add(this, |
437 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 436 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
(...skipping 23 matching lines...) Expand all Loading... |
461 manager->Initialize(SOUND_PASSTHROUGH, | 460 manager->Initialize(SOUND_PASSTHROUGH, |
462 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); | 461 bundle.GetRawDataResource(IDR_SOUND_PASSTHROUGH_WAV)); |
463 manager->Initialize(SOUND_EXIT_SCREEN, | 462 manager->Initialize(SOUND_EXIT_SCREEN, |
464 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); | 463 bundle.GetRawDataResource(IDR_SOUND_EXIT_SCREEN_WAV)); |
465 manager->Initialize(SOUND_ENTER_SCREEN, | 464 manager->Initialize(SOUND_ENTER_SCREEN, |
466 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); | 465 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); |
467 } | 466 } |
468 | 467 |
469 AccessibilityManager::~AccessibilityManager() { | 468 AccessibilityManager::~AccessibilityManager() { |
470 CHECK(this == g_accessibility_manager); | 469 CHECK(this == g_accessibility_manager); |
471 AccessibilityStatusEventDetails details( | 470 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, |
472 ACCESSIBILITY_MANAGER_SHUTDOWN, | 471 ash::A11Y_NOTIFICATION_NONE); |
473 false, | |
474 ui::A11Y_NOTIFICATION_NONE); | |
475 NotifyAccessibilityStatusChanged(details); | 472 NotifyAccessibilityStatusChanged(details); |
476 input_method::InputMethodManager::Get()->RemoveObserver(this); | 473 input_method::InputMethodManager::Get()->RemoveObserver(this); |
477 | 474 |
478 if (chromevox_panel_) { | 475 if (chromevox_panel_) { |
479 chromevox_panel_->Close(); | 476 chromevox_panel_->Close(); |
480 chromevox_panel_ = nullptr; | 477 chromevox_panel_ = nullptr; |
481 } | 478 } |
482 } | 479 } |
483 | 480 |
484 bool AccessibilityManager::ShouldShowAccessibilityMenu() { | 481 bool AccessibilityManager::ShouldShowAccessibilityMenu() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return; | 528 return; |
532 | 529 |
533 const bool enabled = | 530 const bool enabled = |
534 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); | 531 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); |
535 | 532 |
536 if (large_cursor_enabled_ == enabled) | 533 if (large_cursor_enabled_ == enabled) |
537 return; | 534 return; |
538 | 535 |
539 large_cursor_enabled_ = enabled; | 536 large_cursor_enabled_ = enabled; |
540 | 537 |
541 AccessibilityStatusEventDetails details( | 538 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_LARGE_CURSOR, |
542 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, | 539 enabled, ash::A11Y_NOTIFICATION_NONE); |
543 enabled, | |
544 ui::A11Y_NOTIFICATION_NONE); | |
545 | 540 |
546 NotifyAccessibilityStatusChanged(details); | 541 NotifyAccessibilityStatusChanged(details); |
547 | 542 |
548 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( | 543 ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( |
549 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); | 544 enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); |
550 ash::Shell::GetInstance()->SetCursorCompositingEnabled( | 545 ash::Shell::GetInstance()->SetCursorCompositingEnabled( |
551 ShouldEnableCursorCompositing()); | 546 ShouldEnableCursorCompositing()); |
552 } | 547 } |
553 | 548 |
554 bool AccessibilityManager::IsIncognitoAllowed() { | 549 bool AccessibilityManager::IsIncognitoAllowed() { |
(...skipping 28 matching lines...) Expand all Loading... |
583 | 578 |
584 if (sticky_keys_enabled_ == enabled) | 579 if (sticky_keys_enabled_ == enabled) |
585 return; | 580 return; |
586 | 581 |
587 sticky_keys_enabled_ = enabled; | 582 sticky_keys_enabled_ = enabled; |
588 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); | 583 ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); |
589 } | 584 } |
590 | 585 |
591 void AccessibilityManager::EnableSpokenFeedback( | 586 void AccessibilityManager::EnableSpokenFeedback( |
592 bool enabled, | 587 bool enabled, |
593 ui::AccessibilityNotificationVisibility notify) { | 588 ash::AccessibilityNotificationVisibility notify) { |
594 if (!profile_) | 589 if (!profile_) |
595 return; | 590 return; |
596 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 591 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
597 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK | 592 enabled ? ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK |
598 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); | 593 : ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK); |
599 | 594 |
600 spoken_feedback_notification_ = notify; | 595 spoken_feedback_notification_ = notify; |
601 | 596 |
602 PrefService* pref_service = profile_->GetPrefs(); | 597 PrefService* pref_service = profile_->GetPrefs(); |
603 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); | 598 pref_service->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, enabled); |
604 pref_service->CommitPendingWrite(); | 599 pref_service->CommitPendingWrite(); |
605 | 600 |
606 spoken_feedback_notification_ = ui::A11Y_NOTIFICATION_NONE; | 601 spoken_feedback_notification_ = ash::A11Y_NOTIFICATION_NONE; |
607 } | 602 } |
608 | 603 |
609 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { | 604 void AccessibilityManager::UpdateSpokenFeedbackFromPref() { |
610 if (!profile_) | 605 if (!profile_) |
611 return; | 606 return; |
612 | 607 |
613 const bool enabled = profile_->GetPrefs()->GetBoolean( | 608 const bool enabled = profile_->GetPrefs()->GetBoolean( |
614 prefs::kAccessibilitySpokenFeedbackEnabled); | 609 prefs::kAccessibilitySpokenFeedbackEnabled); |
615 | 610 |
616 if (spoken_feedback_enabled_ == enabled) | 611 if (spoken_feedback_enabled_ == enabled) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 Profile* signin_profile = ProfileHelper::GetSigninProfile(); | 716 Profile* signin_profile = ProfileHelper::GetSigninProfile(); |
722 UnloadChromeVoxExtension(signin_profile); | 717 UnloadChromeVoxExtension(signin_profile); |
723 chrome_vox_loaded_on_lock_screen_ = false; | 718 chrome_vox_loaded_on_lock_screen_ = false; |
724 } | 719 } |
725 | 720 |
726 bool AccessibilityManager::IsSpokenFeedbackEnabled() { | 721 bool AccessibilityManager::IsSpokenFeedbackEnabled() { |
727 return spoken_feedback_enabled_; | 722 return spoken_feedback_enabled_; |
728 } | 723 } |
729 | 724 |
730 void AccessibilityManager::ToggleSpokenFeedback( | 725 void AccessibilityManager::ToggleSpokenFeedback( |
731 ui::AccessibilityNotificationVisibility notify) { | 726 ash::AccessibilityNotificationVisibility notify) { |
732 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); | 727 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); |
733 } | 728 } |
734 | 729 |
735 void AccessibilityManager::EnableHighContrast(bool enabled) { | 730 void AccessibilityManager::EnableHighContrast(bool enabled) { |
736 if (!profile_) | 731 if (!profile_) |
737 return; | 732 return; |
738 | 733 |
739 PrefService* pref_service = profile_->GetPrefs(); | 734 PrefService* pref_service = profile_->GetPrefs(); |
740 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); | 735 pref_service->SetBoolean(prefs::kAccessibilityHighContrastEnabled, enabled); |
741 pref_service->CommitPendingWrite(); | 736 pref_service->CommitPendingWrite(); |
742 } | 737 } |
743 | 738 |
744 void AccessibilityManager::UpdateHighContrastFromPref() { | 739 void AccessibilityManager::UpdateHighContrastFromPref() { |
745 if (!profile_) | 740 if (!profile_) |
746 return; | 741 return; |
747 | 742 |
748 const bool enabled = profile_->GetPrefs()->GetBoolean( | 743 const bool enabled = profile_->GetPrefs()->GetBoolean( |
749 prefs::kAccessibilityHighContrastEnabled); | 744 prefs::kAccessibilityHighContrastEnabled); |
750 | 745 |
751 if (high_contrast_enabled_ == enabled) | 746 if (high_contrast_enabled_ == enabled) |
752 return; | 747 return; |
753 | 748 |
754 high_contrast_enabled_ = enabled; | 749 high_contrast_enabled_ = enabled; |
755 | 750 |
756 AccessibilityStatusEventDetails details( | 751 AccessibilityStatusEventDetails details( |
757 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | 752 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, enabled, |
758 enabled, | 753 ash::A11Y_NOTIFICATION_NONE); |
759 ui::A11Y_NOTIFICATION_NONE); | |
760 | 754 |
761 NotifyAccessibilityStatusChanged(details); | 755 NotifyAccessibilityStatusChanged(details); |
762 | 756 |
763 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); | 757 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); |
764 ash::Shell::GetInstance()->SetCursorCompositingEnabled( | 758 ash::Shell::GetInstance()->SetCursorCompositingEnabled( |
765 ShouldEnableCursorCompositing()); | 759 ShouldEnableCursorCompositing()); |
766 } | 760 } |
767 | 761 |
768 void AccessibilityManager::OnLocaleChanged() { | 762 void AccessibilityManager::OnLocaleChanged() { |
769 if (!profile_) | 763 if (!profile_) |
770 return; | 764 return; |
771 | 765 |
772 if (!IsSpokenFeedbackEnabled()) | 766 if (!IsSpokenFeedbackEnabled()) |
773 return; | 767 return; |
774 | 768 |
775 // If the system locale changes and spoken feedback is enabled, | 769 // If the system locale changes and spoken feedback is enabled, |
776 // reload ChromeVox so that it switches its internal translations | 770 // reload ChromeVox so that it switches its internal translations |
777 // to the new language. | 771 // to the new language. |
778 EnableSpokenFeedback(false, ui::A11Y_NOTIFICATION_NONE); | 772 EnableSpokenFeedback(false, ash::A11Y_NOTIFICATION_NONE); |
779 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_NONE); | 773 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_NONE); |
780 } | 774 } |
781 | 775 |
782 void AccessibilityManager::PlayEarcon(int sound_key) { | 776 void AccessibilityManager::PlayEarcon(int sound_key) { |
783 DCHECK(sound_key < chromeos::SOUND_COUNT); | 777 DCHECK(sound_key < chromeos::SOUND_COUNT); |
784 ash::PlaySystemSoundIfSpokenFeedback(sound_key); | 778 ash::PlaySystemSoundIfSpokenFeedback(sound_key); |
785 } | 779 } |
786 | 780 |
787 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { | 781 void AccessibilityManager::HandleAccessibilityGesture(ui::AXGesture gesture) { |
788 extensions::EventRouter* event_router = | 782 extensions::EventRouter* event_router = |
789 extensions::EventRouter::Get(profile()); | 783 extensions::EventRouter::Get(profile()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 // enable typing of hotkeys. A compact version is used in touchview mode | 891 // enable typing of hotkeys. A compact version is used in touchview mode |
898 // to provide a layout with larger keys to facilitate touch typing. In the | 892 // to provide a layout with larger keys to facilitate touch typing. In the |
899 // event that the a11y keyboard is being disabled, an on-screen keyboard might | 893 // event that the a11y keyboard is being disabled, an on-screen keyboard might |
900 // still be enabled and a forced reset is required to pick up the layout | 894 // still be enabled and a forced reset is required to pick up the layout |
901 // change. | 895 // change. |
902 if (keyboard::IsKeyboardEnabled()) | 896 if (keyboard::IsKeyboardEnabled()) |
903 ash::Shell::GetInstance()->CreateKeyboard(); | 897 ash::Shell::GetInstance()->CreateKeyboard(); |
904 else | 898 else |
905 ash::Shell::GetInstance()->DeactivateKeyboard(); | 899 ash::Shell::GetInstance()->DeactivateKeyboard(); |
906 | 900 |
907 AccessibilityStatusEventDetails details( | 901 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
908 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | 902 enabled, ash::A11Y_NOTIFICATION_NONE); |
909 enabled, | |
910 ui::A11Y_NOTIFICATION_NONE); | |
911 NotifyAccessibilityStatusChanged(details); | 903 NotifyAccessibilityStatusChanged(details); |
912 } | 904 } |
913 | 905 |
914 void AccessibilityManager::EnableMonoAudio(bool enabled) { | 906 void AccessibilityManager::EnableMonoAudio(bool enabled) { |
915 if (!profile_) | 907 if (!profile_) |
916 return; | 908 return; |
917 | 909 |
918 PrefService* pref_service = profile_->GetPrefs(); | 910 PrefService* pref_service = profile_->GetPrefs(); |
919 pref_service->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, | 911 pref_service->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, |
920 enabled); | 912 enabled); |
921 pref_service->CommitPendingWrite(); | 913 pref_service->CommitPendingWrite(); |
922 } | 914 } |
923 | 915 |
924 bool AccessibilityManager::IsMonoAudioEnabled() { | 916 bool AccessibilityManager::IsMonoAudioEnabled() { |
925 return mono_audio_enabled_; | 917 return mono_audio_enabled_; |
926 } | 918 } |
927 | 919 |
928 void AccessibilityManager::UpdateMonoAudioFromPref() { | 920 void AccessibilityManager::UpdateMonoAudioFromPref() { |
929 if (!profile_) | 921 if (!profile_) |
930 return; | 922 return; |
931 | 923 |
932 const bool enabled = profile_->GetPrefs()->GetBoolean( | 924 const bool enabled = profile_->GetPrefs()->GetBoolean( |
933 prefs::kAccessibilityMonoAudioEnabled); | 925 prefs::kAccessibilityMonoAudioEnabled); |
934 | 926 |
935 if (mono_audio_enabled_ == enabled) | 927 if (mono_audio_enabled_ == enabled) |
936 return; | 928 return; |
937 mono_audio_enabled_ = enabled; | 929 mono_audio_enabled_ = enabled; |
938 | 930 |
939 AccessibilityStatusEventDetails details( | 931 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_MONO_AUDIO, |
940 ACCESSIBILITY_TOGGLE_MONO_AUDIO, | 932 enabled, ash::A11Y_NOTIFICATION_NONE); |
941 enabled, | |
942 ui::A11Y_NOTIFICATION_NONE); | |
943 NotifyAccessibilityStatusChanged(details); | 933 NotifyAccessibilityStatusChanged(details); |
944 | 934 |
945 ash::Shell::GetInstance()->audio_a11y_controller()->SetOutputMono(enabled); | 935 ash::Shell::GetInstance()->audio_a11y_controller()->SetOutputMono(enabled); |
946 } | 936 } |
947 | 937 |
948 void AccessibilityManager::SetCaretHighlightEnabled(bool enabled) { | 938 void AccessibilityManager::SetCaretHighlightEnabled(bool enabled) { |
949 if (!profile_) | 939 if (!profile_) |
950 return; | 940 return; |
951 | 941 |
952 PrefService* pref_service = profile_->GetPrefs(); | 942 PrefService* pref_service = profile_->GetPrefs(); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", | 1330 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast", |
1341 IsHighContrastEnabled()); | 1331 IsHighContrastEnabled()); |
1342 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", | 1332 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", |
1343 IsVirtualKeyboardEnabled()); | 1333 IsVirtualKeyboardEnabled()); |
1344 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); | 1334 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); |
1345 if (MagnificationManager::Get()) { | 1335 if (MagnificationManager::Get()) { |
1346 uint32_t type = MagnificationManager::Get()->IsMagnifierEnabled() | 1336 uint32_t type = MagnificationManager::Get()->IsMagnifierEnabled() |
1347 ? MagnificationManager::Get()->GetMagnifierType() | 1337 ? MagnificationManager::Get()->GetMagnifierType() |
1348 : 0; | 1338 : 0; |
1349 // '0' means magnifier is disabled. | 1339 // '0' means magnifier is disabled. |
1350 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", | 1340 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", type, |
1351 type, | 1341 ash::kMaxMagnifierType + 1); |
1352 ui::kMaxMagnifierType + 1); | |
1353 } | 1342 } |
1354 if (profile_) { | 1343 if (profile_) { |
1355 const PrefService* const prefs = profile_->GetPrefs(); | 1344 const PrefService* const prefs = profile_->GetPrefs(); |
1356 UMA_HISTOGRAM_BOOLEAN( | 1345 UMA_HISTOGRAM_BOOLEAN( |
1357 "Accessibility.CrosLargeCursor", | 1346 "Accessibility.CrosLargeCursor", |
1358 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); | 1347 prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); |
1359 UMA_HISTOGRAM_BOOLEAN( | 1348 UMA_HISTOGRAM_BOOLEAN( |
1360 "Accessibility.CrosAlwaysShowA11yMenu", | 1349 "Accessibility.CrosAlwaysShowA11yMenu", |
1361 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); | 1350 prefs->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu)); |
1362 | 1351 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 } | 1420 } |
1432 break; | 1421 break; |
1433 } | 1422 } |
1434 } | 1423 } |
1435 } | 1424 } |
1436 | 1425 |
1437 void AccessibilityManager::OnBrailleDisplayStateChanged( | 1426 void AccessibilityManager::OnBrailleDisplayStateChanged( |
1438 const DisplayState& display_state) { | 1427 const DisplayState& display_state) { |
1439 braille_display_connected_ = display_state.available; | 1428 braille_display_connected_ = display_state.available; |
1440 if (braille_display_connected_) { | 1429 if (braille_display_connected_) { |
1441 EnableSpokenFeedback(true, ui::A11Y_NOTIFICATION_SHOW); | 1430 EnableSpokenFeedback(true, ash::A11Y_NOTIFICATION_SHOW); |
1442 } | 1431 } |
1443 UpdateBrailleImeState(); | 1432 UpdateBrailleImeState(); |
1444 | 1433 |
1445 AccessibilityStatusEventDetails details( | 1434 AccessibilityStatusEventDetails details( |
1446 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, | 1435 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED, |
1447 braille_display_connected_, | 1436 braille_display_connected_, ash::A11Y_NOTIFICATION_SHOW); |
1448 ui::A11Y_NOTIFICATION_SHOW); | |
1449 NotifyAccessibilityStatusChanged(details); | 1437 NotifyAccessibilityStatusChanged(details); |
1450 } | 1438 } |
1451 | 1439 |
1452 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { | 1440 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { |
1453 // Ensure the braille IME is active on braille keyboard (dots) input. | 1441 // Ensure the braille IME is active on braille keyboard (dots) input. |
1454 if ((event.command == | 1442 if ((event.command == |
1455 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && | 1443 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && |
1456 !braille_ime_current_) { | 1444 !braille_ime_current_) { |
1457 input_method::InputMethodManager::Get() | 1445 input_method::InputMethodManager::Get() |
1458 ->GetActiveIMEState() | 1446 ->GetActiveIMEState() |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 content::BrowserContext* context) { | 1528 content::BrowserContext* context) { |
1541 keyboard_listener_extension_id_ = id; | 1529 keyboard_listener_extension_id_ = id; |
1542 | 1530 |
1543 extensions::ExtensionRegistry* registry = | 1531 extensions::ExtensionRegistry* registry = |
1544 extensions::ExtensionRegistry::Get(context); | 1532 extensions::ExtensionRegistry::Get(context); |
1545 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1533 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
1546 extension_registry_observer_.Add(registry); | 1534 extension_registry_observer_.Add(registry); |
1547 } | 1535 } |
1548 | 1536 |
1549 } // namespace chromeos | 1537 } // namespace chromeos |
OLD | NEW |