blob: 0be79b5514ed25b66e5c0768a76b47c6c56e22ad [file] [log] [blame]
James Cookb0bf8e82017-04-09 17:01:441// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ASH_ACCESSIBILITY_DELEGATE_H_
6#define ASH_ACCESSIBILITY_DELEGATE_H_
7
8#include "ash/accessibility_types.h"
9#include "ash/ash_export.h"
10#include "base/time/time.h"
11#include "ui/accessibility/ax_enums.h"
12
13namespace ash {
14
15// A delegate class to control and query accessibility features.
16class ASH_EXPORT AccessibilityDelegate {
17 public:
18 virtual ~AccessibilityDelegate() {}
19
20 // Invoked to toggle spoken feedback for accessibility
21 virtual void ToggleSpokenFeedback(
22 AccessibilityNotificationVisibility notify) = 0;
23
24 // Returns true if spoken feedback is enabled.
25 virtual bool IsSpokenFeedbackEnabled() const = 0;
26
27 // Invoked to toggle high contrast mode for accessibility.
28 virtual void ToggleHighContrast() = 0;
29
30 // Returns true if high contrast mode is enabled.
31 virtual bool IsHighContrastEnabled() const = 0;
32
33 // Invoked to enable the screen magnifier.
34 virtual void SetMagnifierEnabled(bool enabled) = 0;
35
36 // Invoked to change the type of the screen magnifier.
37 virtual void SetMagnifierType(MagnifierType type) = 0;
38
39 // Returns true if the screen magnifier is enabled.
40 virtual bool IsMagnifierEnabled() const = 0;
41
42 // Returns the current screen magnifier mode.
43 virtual MagnifierType GetMagnifierType() const = 0;
44
45 // Invoked to enable Large Cursor.
46 virtual void SetLargeCursorEnabled(bool enabled) = 0;
47
48 // Returns true if Large Cursor is enabled.
49 virtual bool IsLargeCursorEnabled() const = 0;
50
51 // Invoked to enable autoclick.
52 virtual void SetAutoclickEnabled(bool enabled) = 0;
53
54 // Returns if autoclick is enabled or not.
55 virtual bool IsAutoclickEnabled() const = 0;
56
57 // Invoked to enable or disable the a11y on-screen keyboard.
58 virtual void SetVirtualKeyboardEnabled(bool enabled) = 0;
59
60 // Returns if the a11y virtual keyboard is enabled.
61 virtual bool IsVirtualKeyboardEnabled() const = 0;
62
63 // Invoked to enable or disable the mono audio output.
64 virtual void SetMonoAudioEnabled(bool enabled) = 0;
65
66 // Returns if the mono audio output is enabled.
67 virtual bool IsMonoAudioEnabled() const = 0;
68
69 // Invoked to enable or disable caret highlighting.
70 virtual void SetCaretHighlightEnabled(bool enabled) = 0;
71
72 // Returns if caret highlighting is enabled.
73 virtual bool IsCaretHighlightEnabled() const = 0;
74
75 // Invoked to enable or disable cursor highlighting.
76 virtual void SetCursorHighlightEnabled(bool enabled) = 0;
77
78 // Returns if cursor highlighting is enabled.
79 virtual bool IsCursorHighlightEnabled() const = 0;
80
81 // Invoked to enable or disable focus highlighting.
82 virtual void SetFocusHighlightEnabled(bool enabled) = 0;
83
84 // Returns if focus highlighting is enabled.
85 virtual bool IsFocusHighlightEnabled() const = 0;
86
87 // Invoked to enable or disable sticky keys.
88 virtual void SetStickyKeysEnabled(bool enabled) = 0;
89
90 // Returns if sticky keys is enabled.
91 virtual bool IsStickyKeysEnabled() const = 0;
92
93 // Invoked to enable or disable tap dragging.
94 virtual void SetTapDraggingEnabled(bool enabled) = 0;
95
96 // Returns if tap dragging is enabled.
97 virtual bool IsTapDraggingEnabled() const = 0;
98
99 // Invoked to enable or disable select-to-speak.
100 virtual void SetSelectToSpeakEnabled(bool enabled) = 0;
101
102 // Returns if select-to-speak is enabled.
103 virtual bool IsSelectToSpeakEnabled() const = 0;
104
105 // Invoked to enable or disable switch access.
106 virtual void SetSwitchAccessEnabled(bool enabled) = 0;
107
108 // Returns if switch access is enabled.
109 virtual bool IsSwitchAccessEnabled() const = 0;
110
111 // Returns true when the accessibility menu should be shown.
112 virtual bool ShouldShowAccessibilityMenu() const = 0;
113
114 // Returns true if a braille display is connected to the system.
115 virtual bool IsBrailleDisplayConnected() const = 0;
116
117 // Cancel all current and queued speech immediately.
118 virtual void SilenceSpokenFeedback() const = 0;
119
120 // Clear the focus highlight
121 virtual void ClearFocusHighlight() const = 0;
122
123 // Saves the zoom scale of the full screen magnifier.
124 virtual void SaveScreenMagnifierScale(double scale) = 0;
125
126 // Gets a saved value of the zoom scale of full screen magnifier. If a value
127 // is not saved, return a negative value.
128 virtual double GetSavedScreenMagnifierScale() = 0;
129
130 // Triggers an accessibility alert to give the user feedback.
131 virtual void TriggerAccessibilityAlert(AccessibilityAlert alert) = 0;
132
133 // Gets the last accessibility alert that was triggered.
134 virtual AccessibilityAlert GetLastAccessibilityAlert() = 0;
135
dmazzonidf9a1e922017-04-13 05:10:44136 // Called when we first detect two fingers are held down, which can be
137 // used to toggle spoken feedback on some touch-only devices.
138 virtual void OnTwoFingerTouchStart() {}
139
140 // Called when the user is no longer holding down two fingers (including
141 // releasing one, holding down three, or moving them).
142 virtual void OnTwoFingerTouchStop() {}
143
James Cookb0bf8e82017-04-09 17:01:44144 // Whether or not to enable toggling spoken feedback via holding down
145 // two fingers on the screen.
146 virtual bool ShouldToggleSpokenFeedbackViaTouch() = 0;
147
148 // Play tick sound indicating spoken feedback will be toggled after countdown.
149 virtual void PlaySpokenFeedbackToggleCountdown(int tick_count) = 0;
150
151 // Plays an earcon. Earcons are brief and distinctive sounds that indicate
152 // when their mapped event has occurred. The sound key enums can be found in
153 // chromeos/audio/chromeos_sounds.h.
154 virtual void PlayEarcon(int sound_key) = 0;
155
156 // Initiates play of shutdown sound and returns it's duration.
157 virtual base::TimeDelta PlayShutdownSound() const = 0;
158
159 // Forward an accessibility gesture from the touch exploration controller to
160 // ChromeVox.
161 virtual void HandleAccessibilityGesture(ui::AXGesture gesture) = 0;
162};
163
164} // namespace ash
165
166#endif // ASH_ACCESSIBILITY_DELEGATE_H_