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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 ++it) { | 349 ++it) { |
350 PrefService* pref_service = (*it)->GetPrefs(); | 350 PrefService* pref_service = (*it)->GetPrefs(); |
351 if (pref_service->GetBoolean(prefs::kAccessibilityStickyKeysEnabled) || | 351 if (pref_service->GetBoolean(prefs::kAccessibilityStickyKeysEnabled) || |
352 pref_service->GetBoolean(prefs::kAccessibilityLargeCursorEnabled) || | 352 pref_service->GetBoolean(prefs::kAccessibilityLargeCursorEnabled) || |
353 pref_service->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled) || | 353 pref_service->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled) || |
354 pref_service->GetBoolean(prefs::kAccessibilityHighContrastEnabled) || | 354 pref_service->GetBoolean(prefs::kAccessibilityHighContrastEnabled) || |
355 pref_service->GetBoolean(prefs::kAccessibilityAutoclickEnabled) || | 355 pref_service->GetBoolean(prefs::kAccessibilityAutoclickEnabled) || |
356 pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu) || | 356 pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu) || |
357 pref_service->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled) || | 357 pref_service->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled) || |
358 pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled) || | 358 pref_service->GetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled) || |
359 pref_service->GetBoolean(prefs::kAccessibilityMonoAudioEnabled)) | 359 pref_service->GetBoolean(prefs::kAccessibilityMonoAudioEnabled) || |
| 360 pref_service->GetBoolean(prefs::kAccessibilityCaretHighlightEnabled) || |
| 361 pref_service->GetBoolean(prefs::kAccessibilityCursorHighlightEnabled) || |
| 362 pref_service->GetBoolean(prefs::kAccessibilityFocusHighlightEnabled)) |
360 return true; | 363 return true; |
361 } | 364 } |
362 return false; | 365 return false; |
363 } | 366 } |
364 | 367 |
365 bool AccessibilityManager::ShouldEnableCursorCompositing() { | 368 bool AccessibilityManager::ShouldEnableCursorCompositing() { |
366 if (!profile_) | 369 if (!profile_) |
367 return false; | 370 return false; |
368 PrefService* pref_service = profile_->GetPrefs(); | 371 PrefService* pref_service = profile_->GetPrefs(); |
369 // Enable cursor compositing when one or more of the listed accessibility | 372 // Enable cursor compositing when one or more of the listed accessibility |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 if (!profile_) | 822 if (!profile_) |
820 return; | 823 return; |
821 | 824 |
822 const bool enabled = profile_->GetPrefs()->GetBoolean( | 825 const bool enabled = profile_->GetPrefs()->GetBoolean( |
823 prefs::kAccessibilityCaretHighlightEnabled); | 826 prefs::kAccessibilityCaretHighlightEnabled); |
824 | 827 |
825 if (caret_highlight_enabled_ == enabled) | 828 if (caret_highlight_enabled_ == enabled) |
826 return; | 829 return; |
827 caret_highlight_enabled_ = enabled; | 830 caret_highlight_enabled_ = enabled; |
828 | 831 |
| 832 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_CARET_HIGHLIGHT, |
| 833 enabled, ash::A11Y_NOTIFICATION_NONE); |
| 834 NotifyAccessibilityStatusChanged(details); |
829 UpdateAccessibilityHighlightingFromPrefs(); | 835 UpdateAccessibilityHighlightingFromPrefs(); |
830 } | 836 } |
831 | 837 |
832 void AccessibilityManager::SetCursorHighlightEnabled(bool enabled) { | 838 void AccessibilityManager::SetCursorHighlightEnabled(bool enabled) { |
833 if (!profile_) | 839 if (!profile_) |
834 return; | 840 return; |
835 | 841 |
836 PrefService* pref_service = profile_->GetPrefs(); | 842 PrefService* pref_service = profile_->GetPrefs(); |
837 pref_service->SetBoolean(prefs::kAccessibilityCursorHighlightEnabled, | 843 pref_service->SetBoolean(prefs::kAccessibilityCursorHighlightEnabled, |
838 enabled); | 844 enabled); |
839 pref_service->CommitPendingWrite(); | 845 pref_service->CommitPendingWrite(); |
840 } | 846 } |
841 | 847 |
842 bool AccessibilityManager::IsCursorHighlightEnabled() const { | 848 bool AccessibilityManager::IsCursorHighlightEnabled() const { |
843 return cursor_highlight_enabled_; | 849 return cursor_highlight_enabled_; |
844 } | 850 } |
845 | 851 |
846 void AccessibilityManager::UpdateCursorHighlightFromPref() { | 852 void AccessibilityManager::UpdateCursorHighlightFromPref() { |
847 if (!profile_) | 853 if (!profile_) |
848 return; | 854 return; |
849 | 855 |
850 const bool enabled = profile_->GetPrefs()->GetBoolean( | 856 const bool enabled = profile_->GetPrefs()->GetBoolean( |
851 prefs::kAccessibilityCursorHighlightEnabled); | 857 prefs::kAccessibilityCursorHighlightEnabled); |
852 | 858 |
853 if (cursor_highlight_enabled_ == enabled) | 859 if (cursor_highlight_enabled_ == enabled) |
854 return; | 860 return; |
855 cursor_highlight_enabled_ = enabled; | 861 cursor_highlight_enabled_ = enabled; |
856 | 862 |
| 863 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_CURSOR_HIGHLIGHT, |
| 864 enabled, ash::A11Y_NOTIFICATION_NONE); |
| 865 NotifyAccessibilityStatusChanged(details); |
857 UpdateAccessibilityHighlightingFromPrefs(); | 866 UpdateAccessibilityHighlightingFromPrefs(); |
858 } | 867 } |
859 | 868 |
860 void AccessibilityManager::SetFocusHighlightEnabled(bool enabled) { | 869 void AccessibilityManager::SetFocusHighlightEnabled(bool enabled) { |
861 if (!profile_) | 870 if (!profile_) |
862 return; | 871 return; |
863 | 872 |
864 PrefService* pref_service = profile_->GetPrefs(); | 873 PrefService* pref_service = profile_->GetPrefs(); |
865 pref_service->SetBoolean(prefs::kAccessibilityFocusHighlightEnabled, enabled); | 874 pref_service->SetBoolean(prefs::kAccessibilityFocusHighlightEnabled, enabled); |
866 pref_service->CommitPendingWrite(); | 875 pref_service->CommitPendingWrite(); |
(...skipping 13 matching lines...) Expand all Loading... |
880 // Focus highlighting can't be on when spoken feedback is on, because | 889 // Focus highlighting can't be on when spoken feedback is on, because |
881 // ChromeVox does its own focus highlighting. | 890 // ChromeVox does its own focus highlighting. |
882 if (profile_->GetPrefs()->GetBoolean( | 891 if (profile_->GetPrefs()->GetBoolean( |
883 prefs::kAccessibilitySpokenFeedbackEnabled)) | 892 prefs::kAccessibilitySpokenFeedbackEnabled)) |
884 enabled = false; | 893 enabled = false; |
885 | 894 |
886 if (focus_highlight_enabled_ == enabled) | 895 if (focus_highlight_enabled_ == enabled) |
887 return; | 896 return; |
888 focus_highlight_enabled_ = enabled; | 897 focus_highlight_enabled_ = enabled; |
889 | 898 |
| 899 AccessibilityStatusEventDetails details(ACCESSIBILITY_TOGGLE_FOCUS_HIGHLIGHT, |
| 900 enabled, ash::A11Y_NOTIFICATION_NONE); |
| 901 NotifyAccessibilityStatusChanged(details); |
890 UpdateAccessibilityHighlightingFromPrefs(); | 902 UpdateAccessibilityHighlightingFromPrefs(); |
891 } | 903 } |
892 | 904 |
893 void AccessibilityManager::SetSelectToSpeakEnabled(bool enabled) { | 905 void AccessibilityManager::SetSelectToSpeakEnabled(bool enabled) { |
894 if (!profile_) | 906 if (!profile_) |
895 return; | 907 return; |
896 | 908 |
897 PrefService* pref_service = profile_->GetPrefs(); | 909 PrefService* pref_service = profile_->GetPrefs(); |
898 pref_service->SetBoolean(prefs::kAccessibilitySelectToSpeakEnabled, enabled); | 910 pref_service->SetBoolean(prefs::kAccessibilitySelectToSpeakEnabled, enabled); |
899 pref_service->CommitPendingWrite(); | 911 pref_service->CommitPendingWrite(); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 content::BrowserContext* context) { | 1448 content::BrowserContext* context) { |
1437 keyboard_listener_extension_id_ = id; | 1449 keyboard_listener_extension_id_ = id; |
1438 | 1450 |
1439 extensions::ExtensionRegistry* registry = | 1451 extensions::ExtensionRegistry* registry = |
1440 extensions::ExtensionRegistry::Get(context); | 1452 extensions::ExtensionRegistry::Get(context); |
1441 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1453 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
1442 extension_registry_observer_.Add(registry); | 1454 extension_registry_observer_.Add(registry); |
1443 } | 1455 } |
1444 | 1456 |
1445 } // namespace chromeos | 1457 } // namespace chromeos |
OLD | NEW |