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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 ShouldEnableCursorCompositing()); | 428 ShouldEnableCursorCompositing()); |
429 } | 429 } |
430 | 430 |
431 bool AccessibilityManager::IsIncognitoAllowed() { | 431 bool AccessibilityManager::IsIncognitoAllowed() { |
432 return profile_ != NULL && | 432 return profile_ != NULL && |
433 profile_->GetProfileType() != Profile::GUEST_PROFILE && | 433 profile_->GetProfileType() != Profile::GUEST_PROFILE && |
434 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != | 434 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != |
435 IncognitoModePrefs::DISABLED; | 435 IncognitoModePrefs::DISABLED; |
436 } | 436 } |
437 | 437 |
438 bool AccessibilityManager::IsLargeCursorEnabled() { | 438 bool AccessibilityManager::IsLargeCursorEnabled() const { |
439 return large_cursor_enabled_; | 439 return large_cursor_enabled_; |
440 } | 440 } |
441 | 441 |
442 void AccessibilityManager::EnableStickyKeys(bool enabled) { | 442 void AccessibilityManager::EnableStickyKeys(bool enabled) { |
443 if (!profile_) | 443 if (!profile_) |
444 return; | 444 return; |
445 PrefService* pref_service = profile_->GetPrefs(); | 445 PrefService* pref_service = profile_->GetPrefs(); |
446 pref_service->SetBoolean(prefs::kAccessibilityStickyKeysEnabled, enabled); | 446 pref_service->SetBoolean(prefs::kAccessibilityStickyKeysEnabled, enabled); |
447 pref_service->CommitPendingWrite(); | 447 pref_service->CommitPendingWrite(); |
448 } | 448 } |
449 | 449 |
450 bool AccessibilityManager::IsStickyKeysEnabled() { | 450 bool AccessibilityManager::IsStickyKeysEnabled() const { |
451 return sticky_keys_enabled_; | 451 return sticky_keys_enabled_; |
452 } | 452 } |
453 | 453 |
454 void AccessibilityManager::UpdateStickyKeysFromPref() { | 454 void AccessibilityManager::UpdateStickyKeysFromPref() { |
455 if (!profile_) | 455 if (!profile_) |
456 return; | 456 return; |
457 | 457 |
458 const bool enabled = | 458 const bool enabled = |
459 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityStickyKeysEnabled); | 459 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityStickyKeysEnabled); |
460 | 460 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 weak_ptr_factory_.GetWeakPtr())); | 518 weak_ptr_factory_.GetWeakPtr())); |
519 } else { | 519 } else { |
520 chromevox_loader_->Unload(); | 520 chromevox_loader_->Unload(); |
521 } | 521 } |
522 UpdateBrailleImeState(); | 522 UpdateBrailleImeState(); |
523 | 523 |
524 // ChromeVox focus highlighting overrides the other focus highlighting. | 524 // ChromeVox focus highlighting overrides the other focus highlighting. |
525 UpdateFocusHighlightFromPref(); | 525 UpdateFocusHighlightFromPref(); |
526 } | 526 } |
527 | 527 |
528 bool AccessibilityManager::IsSpokenFeedbackEnabled() { | 528 bool AccessibilityManager::IsSpokenFeedbackEnabled() const { |
529 return spoken_feedback_enabled_; | 529 return spoken_feedback_enabled_; |
530 } | 530 } |
531 | 531 |
532 void AccessibilityManager::ToggleSpokenFeedback( | 532 void AccessibilityManager::ToggleSpokenFeedback( |
533 ash::AccessibilityNotificationVisibility notify) { | 533 ash::AccessibilityNotificationVisibility notify) { |
534 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); | 534 EnableSpokenFeedback(!IsSpokenFeedbackEnabled(), notify); |
535 } | 535 } |
536 | 536 |
537 void AccessibilityManager::EnableHighContrast(bool enabled) { | 537 void AccessibilityManager::EnableHighContrast(bool enabled) { |
538 if (!profile_) | 538 if (!profile_) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 extension_misc::kChromeVoxExtensionId, std::move(event)); | 648 extension_misc::kChromeVoxExtensionId, std::move(event)); |
649 } | 649 } |
650 | 650 |
651 void AccessibilityManager::SetTouchAccessibilityAnchorPoint( | 651 void AccessibilityManager::SetTouchAccessibilityAnchorPoint( |
652 const gfx::Point& anchor_point) { | 652 const gfx::Point& anchor_point) { |
653 ash::RootWindowController* root_window_controller = | 653 ash::RootWindowController* root_window_controller = |
654 ash::RootWindowController::ForTargetRootWindow(); | 654 ash::RootWindowController::ForTargetRootWindow(); |
655 root_window_controller->SetTouchAccessibilityAnchorPoint(anchor_point); | 655 root_window_controller->SetTouchAccessibilityAnchorPoint(anchor_point); |
656 } | 656 } |
657 | 657 |
658 bool AccessibilityManager::IsHighContrastEnabled() { | 658 bool AccessibilityManager::IsHighContrastEnabled() const { |
659 return high_contrast_enabled_; | 659 return high_contrast_enabled_; |
660 } | 660 } |
661 | 661 |
662 void AccessibilityManager::EnableAutoclick(bool enabled) { | 662 void AccessibilityManager::EnableAutoclick(bool enabled) { |
663 if (!profile_) | 663 if (!profile_) |
664 return; | 664 return; |
665 | 665 |
666 PrefService* pref_service = profile_->GetPrefs(); | 666 PrefService* pref_service = profile_->GetPrefs(); |
667 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); | 667 pref_service->SetBoolean(prefs::kAccessibilityAutoclickEnabled, enabled); |
668 pref_service->CommitPendingWrite(); | 668 pref_service->CommitPendingWrite(); |
669 } | 669 } |
670 | 670 |
671 bool AccessibilityManager::IsAutoclickEnabled() { | 671 bool AccessibilityManager::IsAutoclickEnabled() const { |
672 return autoclick_enabled_; | 672 return autoclick_enabled_; |
673 } | 673 } |
674 | 674 |
675 void AccessibilityManager::UpdateAutoclickFromPref() { | 675 void AccessibilityManager::UpdateAutoclickFromPref() { |
676 if (!profile_) | 676 if (!profile_) |
677 return; | 677 return; |
678 | 678 |
679 bool enabled = | 679 bool enabled = |
680 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); | 680 profile_->GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); |
681 | 681 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 void AccessibilityManager::EnableVirtualKeyboard(bool enabled) { | 737 void AccessibilityManager::EnableVirtualKeyboard(bool enabled) { |
738 if (!profile_) | 738 if (!profile_) |
739 return; | 739 return; |
740 | 740 |
741 PrefService* pref_service = profile_->GetPrefs(); | 741 PrefService* pref_service = profile_->GetPrefs(); |
742 pref_service->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, | 742 pref_service->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, |
743 enabled); | 743 enabled); |
744 pref_service->CommitPendingWrite(); | 744 pref_service->CommitPendingWrite(); |
745 } | 745 } |
746 | 746 |
747 bool AccessibilityManager::IsVirtualKeyboardEnabled() { | 747 bool AccessibilityManager::IsVirtualKeyboardEnabled() const { |
748 return virtual_keyboard_enabled_; | 748 return virtual_keyboard_enabled_; |
749 } | 749 } |
750 | 750 |
751 void AccessibilityManager::UpdateVirtualKeyboardFromPref() { | 751 void AccessibilityManager::UpdateVirtualKeyboardFromPref() { |
752 if (!profile_) | 752 if (!profile_) |
753 return; | 753 return; |
754 | 754 |
755 const bool enabled = profile_->GetPrefs()->GetBoolean( | 755 const bool enabled = profile_->GetPrefs()->GetBoolean( |
756 prefs::kAccessibilityVirtualKeyboardEnabled); | 756 prefs::kAccessibilityVirtualKeyboardEnabled); |
757 | 757 |
(...skipping 27 matching lines...) Expand all Loading... |
785 void AccessibilityManager::EnableMonoAudio(bool enabled) { | 785 void AccessibilityManager::EnableMonoAudio(bool enabled) { |
786 if (!profile_) | 786 if (!profile_) |
787 return; | 787 return; |
788 | 788 |
789 PrefService* pref_service = profile_->GetPrefs(); | 789 PrefService* pref_service = profile_->GetPrefs(); |
790 pref_service->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, | 790 pref_service->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, |
791 enabled); | 791 enabled); |
792 pref_service->CommitPendingWrite(); | 792 pref_service->CommitPendingWrite(); |
793 } | 793 } |
794 | 794 |
795 bool AccessibilityManager::IsMonoAudioEnabled() { | 795 bool AccessibilityManager::IsMonoAudioEnabled() const { |
796 return mono_audio_enabled_; | 796 return mono_audio_enabled_; |
797 } | 797 } |
798 | 798 |
799 void AccessibilityManager::UpdateMonoAudioFromPref() { | 799 void AccessibilityManager::UpdateMonoAudioFromPref() { |
800 if (!profile_) | 800 if (!profile_) |
801 return; | 801 return; |
802 | 802 |
803 const bool enabled = profile_->GetPrefs()->GetBoolean( | 803 const bool enabled = profile_->GetPrefs()->GetBoolean( |
804 prefs::kAccessibilityMonoAudioEnabled); | 804 prefs::kAccessibilityMonoAudioEnabled); |
805 | 805 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 | 913 |
914 void AccessibilityManager::EnableTapDragging(bool enabled) { | 914 void AccessibilityManager::EnableTapDragging(bool enabled) { |
915 if (!profile_) | 915 if (!profile_) |
916 return; | 916 return; |
917 | 917 |
918 PrefService* pref_service = profile_->GetPrefs(); | 918 PrefService* pref_service = profile_->GetPrefs(); |
919 pref_service->SetBoolean(prefs::kTapDraggingEnabled, enabled); | 919 pref_service->SetBoolean(prefs::kTapDraggingEnabled, enabled); |
920 pref_service->CommitPendingWrite(); | 920 pref_service->CommitPendingWrite(); |
921 } | 921 } |
922 | 922 |
923 bool AccessibilityManager::IsTapDraggingEnabled() { | 923 bool AccessibilityManager::IsTapDraggingEnabled() const { |
924 return tap_dragging_enabled_; | 924 return tap_dragging_enabled_; |
925 } | 925 } |
926 | 926 |
927 void AccessibilityManager::UpdateTapDraggingFromPref() { | 927 void AccessibilityManager::UpdateTapDraggingFromPref() { |
928 if (!profile_) | 928 if (!profile_) |
929 return; | 929 return; |
930 | 930 |
931 const bool enabled = | 931 const bool enabled = |
932 profile_->GetPrefs()->GetBoolean(prefs::kTapDraggingEnabled); | 932 profile_->GetPrefs()->GetBoolean(prefs::kTapDraggingEnabled); |
933 | 933 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 content::BrowserContext* context) { | 1496 content::BrowserContext* context) { |
1497 keyboard_listener_extension_id_ = id; | 1497 keyboard_listener_extension_id_ = id; |
1498 | 1498 |
1499 extensions::ExtensionRegistry* registry = | 1499 extensions::ExtensionRegistry* registry = |
1500 extensions::ExtensionRegistry::Get(context); | 1500 extensions::ExtensionRegistry::Get(context); |
1501 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1501 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
1502 extension_registry_observer_.Add(registry); | 1502 extension_registry_observer_.Add(registry); |
1503 } | 1503 } |
1504 | 1504 |
1505 } // namespace chromeos | 1505 } // namespace chromeos |
OLD | NEW |