1 // Copyright 2020 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 #include "chrome/browser/ui/webui/settings/chromeos/accessibility_section.h"
6 
7 #include <memory>
8 #include <set>
9 #include <string>
10 #include <vector>
11 
12 #include "ash/public/cpp/ash_features.h"
13 #include "ash/public/cpp/ash_pref_names.h"
14 #include "ash/public/cpp/tablet_mode.h"
15 #include "base/command_line.h"
16 #include "base/feature_list.h"
17 #include "base/metrics/histogram_functions.h"
18 #include "base/no_destructor.h"
19 #include "chrome/browser/accessibility/accessibility_state_utils.h"
20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h"
22 #include "chrome/browser/ui/webui/settings/accessibility_main_handler.h"
23 #include "chrome/browser/ui/webui/settings/captions_handler.h"
24 #include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h"
25 #include "chrome/browser/ui/webui/settings/chromeos/search/search_tag_registry.h"
26 #include "chrome/browser/ui/webui/settings/chromeos/tts_handler.h"
27 #include "chrome/browser/ui/webui/settings/font_handler.h"
28 #include "chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.h"
29 #include "chrome/browser/ui/webui/webui_util.h"
30 #include "chrome/common/url_constants.h"
31 #include "chrome/grit/generated_resources.h"
32 #include "components/prefs/pref_service.h"
33 #include "content/public/browser/web_ui_data_source.h"
34 #include "content/public/common/content_features.h"
35 #include "extensions/browser/extension_system.h"
36 #include "media/base/media_switches.h"
37 #include "ui/accessibility/accessibility_features.h"
38 #include "ui/accessibility/accessibility_switches.h"
39 #include "ui/base/l10n/l10n_util.h"
40 #include "ui/base/webui/web_ui_util.h"
41 
42 namespace chromeos {
43 namespace settings {
44 namespace {
45 
GetA11ySearchConcepts()46 const std::vector<SearchConcept>& GetA11ySearchConcepts() {
47   static const base::NoDestructor<std::vector<SearchConcept>> tags({
48       {IDS_OS_SETTINGS_TAG_A11Y_ALWAYS_SHOW_OPTIONS,
49        mojom::kAccessibilitySectionPath,
50        mojom::SearchResultIcon::kA11y,
51        mojom::SearchResultDefaultRank::kMedium,
52        mojom::SearchResultType::kSetting,
53        {.setting = mojom::Setting::kA11yQuickSettings},
54        {IDS_OS_SETTINGS_TAG_A11Y_ALWAYS_SHOW_OPTIONS_ALT1,
55         SearchConcept::kAltTagEnd}},
56       {IDS_OS_SETTINGS_TAG_A11Y_STICKY_KEYS,
57        mojom::kManageAccessibilitySubpagePath,
58        mojom::SearchResultIcon::kA11y,
59        mojom::SearchResultDefaultRank::kMedium,
60        mojom::SearchResultType::kSetting,
61        {.setting = mojom::Setting::kStickyKeys}},
62       {IDS_OS_SETTINGS_TAG_A11Y_LARGE_CURSOR,
63        mojom::kManageAccessibilitySubpagePath,
64        mojom::SearchResultIcon::kA11y,
65        mojom::SearchResultDefaultRank::kMedium,
66        mojom::SearchResultType::kSetting,
67        {.setting = mojom::Setting::kLargeCursor}},
68       {IDS_OS_SETTINGS_TAG_A11Y,
69        mojom::kAccessibilitySectionPath,
70        mojom::SearchResultIcon::kA11y,
71        mojom::SearchResultDefaultRank::kHigh,
72        mojom::SearchResultType::kSection,
73        {.section = mojom::Section::kAccessibility},
74        {IDS_OS_SETTINGS_TAG_A11Y_ALT1, SearchConcept::kAltTagEnd}},
75       {IDS_OS_SETTINGS_TAG_A11Y_DOCKED_MAGNIFIER,
76        mojom::kManageAccessibilitySubpagePath,
77        mojom::SearchResultIcon::kA11y,
78        mojom::SearchResultDefaultRank::kMedium,
79        mojom::SearchResultType::kSetting,
80        {.setting = mojom::Setting::kDockedMagnifier}},
81       {IDS_OS_SETTINGS_TAG_A11y_CHROMEVOX,
82        mojom::kManageAccessibilitySubpagePath,
83        mojom::SearchResultIcon::kA11y,
84        mojom::SearchResultDefaultRank::kMedium,
85        mojom::SearchResultType::kSetting,
86        {.setting = mojom::Setting::kChromeVox},
87        {IDS_OS_SETTINGS_TAG_A11y_CHROMEVOX_ALT1, SearchConcept::kAltTagEnd}},
88       {IDS_OS_SETTINGS_TAG_A11Y_MONO_AUDIO,
89        mojom::kManageAccessibilitySubpagePath,
90        mojom::SearchResultIcon::kA11y,
91        mojom::SearchResultDefaultRank::kLow,
92        mojom::SearchResultType::kSetting,
93        {.setting = mojom::Setting::kMonoAudio},
94        {IDS_OS_SETTINGS_TAG_A11Y_MONO_AUDIO_ALT1, SearchConcept::kAltTagEnd}},
95       {IDS_OS_SETTINGS_TAG_A11Y_TEXT_TO_SPEECH,
96        mojom::kTextToSpeechSubpagePath,
97        mojom::SearchResultIcon::kA11y,
98        mojom::SearchResultDefaultRank::kMedium,
99        mojom::SearchResultType::kSubpage,
100        {.subpage = mojom::Subpage::kTextToSpeech},
101        {IDS_OS_SETTINGS_TAG_A11Y_TEXT_TO_SPEECH_ALT1,
102         SearchConcept::kAltTagEnd}},
103       {IDS_OS_SETTINGS_TAG_A11Y_CAPTIONS,
104        mojom::kCaptionsSubpagePath,
105        mojom::SearchResultIcon::kA11y,
106        mojom::SearchResultDefaultRank::kMedium,
107        mojom::SearchResultType::kSubpage,
108        {.subpage = mojom::Subpage::kCaptions}},
109       {IDS_OS_SETTINGS_TAG_A11Y_HIGHLIGHT_CURSOR,
110        mojom::kManageAccessibilitySubpagePath,
111        mojom::SearchResultIcon::kA11y,
112        mojom::SearchResultDefaultRank::kMedium,
113        mojom::SearchResultType::kSetting,
114        {.setting = mojom::Setting::kHighlightCursorWhileMoving}},
115       {IDS_OS_SETTINGS_TAG_A11Y_MANAGE,
116        mojom::kManageAccessibilitySubpagePath,
117        mojom::SearchResultIcon::kA11y,
118        mojom::SearchResultDefaultRank::kMedium,
119        mojom::SearchResultType::kSubpage,
120        {.subpage = mojom::Subpage::kManageAccessibility},
121        {IDS_OS_SETTINGS_TAG_A11Y_MANAGE_ALT1, SearchConcept::kAltTagEnd}},
122       {IDS_OS_SETTINGS_TAG_A11Y_ON_SCREEN_KEYBOARD,
123        mojom::kManageAccessibilitySubpagePath,
124        mojom::SearchResultIcon::kA11y,
125        mojom::SearchResultDefaultRank::kMedium,
126        mojom::SearchResultType::kSetting,
127        {.setting = mojom::Setting::kOnScreenKeyboard}},
128       {IDS_OS_SETTINGS_TAG_A11Y_HIGHLIGHT_TEXT_CARET,
129        mojom::kManageAccessibilitySubpagePath,
130        mojom::SearchResultIcon::kA11y,
131        mojom::SearchResultDefaultRank::kMedium,
132        mojom::SearchResultType::kSetting,
133        {.setting = mojom::Setting::kHighlightTextCaret}},
134       {IDS_OS_SETTINGS_TAG_A11Y_DICTATION,
135        mojom::kManageAccessibilitySubpagePath,
136        mojom::SearchResultIcon::kA11y,
137        mojom::SearchResultDefaultRank::kMedium,
138        mojom::SearchResultType::kSetting,
139        {.setting = mojom::Setting::kDictation},
140        {IDS_OS_SETTINGS_TAG_A11Y_DICTATION_ALT1, SearchConcept::kAltTagEnd}},
141       {IDS_OS_SETTINGS_TAG_A11Y_HIGH_CONTRAST,
142        mojom::kManageAccessibilitySubpagePath,
143        mojom::SearchResultIcon::kA11y,
144        mojom::SearchResultDefaultRank::kMedium,
145        mojom::SearchResultType::kSetting,
146        {.setting = mojom::Setting::kHighContrastMode},
147        {IDS_OS_SETTINGS_TAG_A11Y_HIGH_CONTRAST_ALT1,
148         SearchConcept::kAltTagEnd}},
149       {IDS_OS_SETTINGS_TAG_A11Y_HIGHLIGHT_KEYBOARD_FOCUS,
150        mojom::kManageAccessibilitySubpagePath,
151        mojom::SearchResultIcon::kA11y,
152        mojom::SearchResultDefaultRank::kMedium,
153        mojom::SearchResultType::kSetting,
154        {.setting = mojom::Setting::kHighlightKeyboardFocus}},
155       {IDS_OS_SETTINGS_TAG_A11Y_STARTUP_SOUND,
156        mojom::kManageAccessibilitySubpagePath,
157        mojom::SearchResultIcon::kA11y,
158        mojom::SearchResultDefaultRank::kMedium,
159        mojom::SearchResultType::kSetting,
160        {.setting = mojom::Setting::kStartupSound}},
161       {IDS_OS_SETTINGS_TAG_A11Y_AUTOMATICALLY_CLICK,
162        mojom::kManageAccessibilitySubpagePath,
163        mojom::SearchResultIcon::kA11y,
164        mojom::SearchResultDefaultRank::kMedium,
165        mojom::SearchResultType::kSetting,
166        {.setting = mojom::Setting::kAutoClickWhenCursorStops}},
167       {IDS_OS_SETTINGS_TAG_A11Y_SELECT_TO_SPEAK,
168        mojom::kManageAccessibilitySubpagePath,
169        mojom::SearchResultIcon::kA11y,
170        mojom::SearchResultDefaultRank::kMedium,
171        mojom::SearchResultType::kSetting,
172        {.setting = mojom::Setting::kSelectToSpeak}},
173       {IDS_OS_SETTINGS_TAG_A11Y_SPEECH_PITCH,
174        mojom::kTextToSpeechSubpagePath,
175        mojom::SearchResultIcon::kA11y,
176        mojom::SearchResultDefaultRank::kMedium,
177        mojom::SearchResultType::kSetting,
178        {.setting = mojom::Setting::kTextToSpeechPitch}},
179       {IDS_OS_SETTINGS_TAG_A11Y_SPEECH_RATE,
180        mojom::kTextToSpeechSubpagePath,
181        mojom::SearchResultIcon::kA11y,
182        mojom::SearchResultDefaultRank::kMedium,
183        mojom::SearchResultType::kSetting,
184        {.setting = mojom::Setting::kTextToSpeechRate}},
185       {IDS_OS_SETTINGS_TAG_A11Y_SPEECH_VOLUME,
186        mojom::kTextToSpeechSubpagePath,
187        mojom::SearchResultIcon::kA11y,
188        mojom::SearchResultDefaultRank::kMedium,
189        mojom::SearchResultType::kSetting,
190        {.setting = mojom::Setting::kTextToSpeechVolume}},
191       {IDS_OS_SETTINGS_TAG_A11Y_FULLSCREEN_MAGNIFIER,
192        mojom::kManageAccessibilitySubpagePath,
193        mojom::SearchResultIcon::kA11y,
194        mojom::SearchResultDefaultRank::kMedium,
195        mojom::SearchResultType::kSetting,
196        {.setting = mojom::Setting::kFullscreenMagnifier}},
197       {IDS_OS_SETTINGS_TAG_A11Y_ENABLE_SWITCH_ACCESS,
198        mojom::kManageAccessibilitySubpagePath,
199        mojom::SearchResultIcon::kA11y,
200        mojom::SearchResultDefaultRank::kMedium,
201        mojom::SearchResultType::kSetting,
202        {.setting = mojom::Setting::kEnableSwitchAccess}},
203   });
204   return *tags;
205 }
206 
GetTextToSpeechVoiceSearchConcepts()207 const std::vector<SearchConcept>& GetTextToSpeechVoiceSearchConcepts() {
208   static const base::NoDestructor<std::vector<SearchConcept>> tags({
209       {IDS_OS_SETTINGS_TAG_A11Y_SPEECH_VOICE_PREVIEW,
210        mojom::kTextToSpeechSubpagePath,
211        mojom::SearchResultIcon::kA11y,
212        mojom::SearchResultDefaultRank::kMedium,
213        mojom::SearchResultType::kSetting,
214        {.setting = mojom::Setting::kTextToSpeechVoice}},
215   });
216   return *tags;
217 }
218 
GetTextToSpeechEnginesSearchConcepts()219 const std::vector<SearchConcept>& GetTextToSpeechEnginesSearchConcepts() {
220   static const base::NoDestructor<std::vector<SearchConcept>> tags({
221       {IDS_OS_SETTINGS_TAG_A11Y_SPEECH_ENGINES,
222        mojom::kTextToSpeechSubpagePath,
223        mojom::SearchResultIcon::kA11y,
224        mojom::SearchResultDefaultRank::kMedium,
225        mojom::SearchResultType::kSetting,
226        {.setting = mojom::Setting::kTextToSpeechEngines}},
227   });
228   return *tags;
229 }
230 
231 const std::vector<SearchConcept>&
GetA11yTabletNavigationButtonSearchConcepts()232 GetA11yTabletNavigationButtonSearchConcepts() {
233   static const base::NoDestructor<std::vector<SearchConcept>> tags({
234       {IDS_OS_SETTINGS_TAG_A11Y_TABLET_NAVIGATION_BUTTONS,
235        mojom::kManageAccessibilitySubpagePath,
236        mojom::SearchResultIcon::kA11y,
237        mojom::SearchResultDefaultRank::kMedium,
238        mojom::SearchResultType::kSetting,
239        {.setting = mojom::Setting::kTabletNavigationButtons}},
240   });
241   return *tags;
242 }
243 
GetA11ySwitchAccessOnSearchConcepts()244 const std::vector<SearchConcept>& GetA11ySwitchAccessOnSearchConcepts() {
245   static const base::NoDestructor<std::vector<SearchConcept>> tags({
246       {IDS_OS_SETTINGS_TAG_A11Y_SWITCH_ACCESS_ASSIGNMENT,
247        mojom::kSwitchAccessOptionsSubpagePath,
248        mojom::SearchResultIcon::kA11y,
249        mojom::SearchResultDefaultRank::kMedium,
250        mojom::SearchResultType::kSetting,
251        {.setting = mojom::Setting::kSwitchActionAssignment}},
252       {IDS_OS_SETTINGS_TAG_A11Y_SWITCH_ACCESS,
253        mojom::kSwitchAccessOptionsSubpagePath,
254        mojom::SearchResultIcon::kA11y,
255        mojom::SearchResultDefaultRank::kMedium,
256        mojom::SearchResultType::kSubpage,
257        {.subpage = mojom::Subpage::kSwitchAccessOptions}},
258       {IDS_OS_SETTINGS_TAG_A11Y_SWITCH_ACCESS_AUTO_SCAN,
259        mojom::kSwitchAccessOptionsSubpagePath,
260        mojom::SearchResultIcon::kA11y,
261        mojom::SearchResultDefaultRank::kMedium,
262        mojom::SearchResultType::kSetting,
263        {.setting = mojom::Setting::kSwitchActionAutoScan}},
264   });
265   return *tags;
266 }
267 
GetA11ySwitchAccessKeyboardSearchConcepts()268 const std::vector<SearchConcept>& GetA11ySwitchAccessKeyboardSearchConcepts() {
269   static const base::NoDestructor<std::vector<SearchConcept>> tags({
270       {IDS_OS_SETTINGS_TAG_A11Y_SWITCH_ACCESS_AUTO_SCAN_KEYBOARD,
271        mojom::kSwitchAccessOptionsSubpagePath,
272        mojom::SearchResultIcon::kA11y,
273        mojom::SearchResultDefaultRank::kMedium,
274        mojom::SearchResultType::kSetting,
275        {.setting = mojom::Setting::kSwitchActionAutoScanKeyboard}},
276   });
277   return *tags;
278 }
279 
GetA11yLabelsSearchConcepts()280 const std::vector<SearchConcept>& GetA11yLabelsSearchConcepts() {
281   static const base::NoDestructor<std::vector<SearchConcept>> tags({
282       {IDS_OS_SETTINGS_TAG_A11Y_LABELS_FROM_GOOGLE,
283        mojom::kAccessibilitySectionPath,
284        mojom::SearchResultIcon::kA11y,
285        mojom::SearchResultDefaultRank::kMedium,
286        mojom::SearchResultType::kSetting,
287        {.setting = mojom::Setting::kGetImageDescriptionsFromGoogle}},
288   });
289   return *tags;
290 }
291 
GetA11yLiveCaptionSearchConcepts()292 const std::vector<SearchConcept>& GetA11yLiveCaptionSearchConcepts() {
293   static const base::NoDestructor<std::vector<SearchConcept>> tags({
294       {IDS_OS_SETTINGS_TAG_A11Y_LIVE_CAPTION,
295        mojom::kManageAccessibilitySubpagePath,
296        mojom::SearchResultIcon::kA11y,
297        mojom::SearchResultDefaultRank::kMedium,
298        mojom::SearchResultType::kSetting,
299        {.setting = mojom::Setting::kLiveCaptions}},
300   });
301   return *tags;
302 }
303 
GetA11yCursorColorSearchConcepts()304 const std::vector<SearchConcept>& GetA11yCursorColorSearchConcepts() {
305   static const base::NoDestructor<std::vector<SearchConcept>> tags({
306       {IDS_OS_SETTINGS_TAG_A11Y_CURSOR_COLOR,
307        mojom::kManageAccessibilitySubpagePath,
308        mojom::SearchResultIcon::kA11y,
309        mojom::SearchResultDefaultRank::kMedium,
310        mojom::SearchResultType::kSetting,
311        {.setting = mojom::Setting::kEnableCursorColor}},
312   });
313   return *tags;
314 }
315 
AreExperimentalA11yLabelsAllowed()316 bool AreExperimentalA11yLabelsAllowed() {
317   return base::FeatureList::IsEnabled(
318       ::features::kExperimentalAccessibilityLabels);
319 }
320 
AreLiveCaptionsAllowed()321 bool AreLiveCaptionsAllowed() {
322   return base::FeatureList::IsEnabled(media::kLiveCaption);
323 }
324 
IsCursorColorAllowed()325 bool IsCursorColorAllowed() {
326   return features::IsAccessibilityCursorColorEnabled();
327 }
328 
IsSwitchAccessTextAllowed()329 bool IsSwitchAccessTextAllowed() {
330   return base::CommandLine::ForCurrentProcess()->HasSwitch(
331       ::switches::kEnableExperimentalAccessibilitySwitchAccessText);
332 }
333 
AreTabletNavigationButtonsAllowed()334 bool AreTabletNavigationButtonsAllowed() {
335   return ash::features::IsHideShelfControlsInTabletModeEnabled() &&
336          ash::TabletMode::IsBoardTypeMarkedAsTabletCapable();
337 }
338 
339 }  // namespace
340 
AccessibilitySection(Profile * profile,SearchTagRegistry * search_tag_registry,PrefService * pref_service)341 AccessibilitySection::AccessibilitySection(
342     Profile* profile,
343     SearchTagRegistry* search_tag_registry,
344     PrefService* pref_service)
345     : OsSettingsSection(profile, search_tag_registry),
346       pref_service_(pref_service) {
347   SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
348   updater.AddSearchTags(GetA11ySearchConcepts());
349 
350   if (AreTabletNavigationButtonsAllowed())
351     updater.AddSearchTags(GetA11yTabletNavigationButtonSearchConcepts());
352 
353   pref_change_registrar_.Init(pref_service_);
354   pref_change_registrar_.Add(
355       ash::prefs::kAccessibilitySwitchAccessEnabled,
356       base::BindRepeating(&AccessibilitySection::UpdateSearchTags,
357                           base::Unretained(this)));
358   pref_change_registrar_.Add(
359       ash::prefs::kAccessibilitySwitchAccessAutoScanEnabled,
360       base::BindRepeating(&AccessibilitySection::UpdateSearchTags,
361                           base::Unretained(this)));
362 
363   UpdateSearchTags();
364 
365   // ExtensionService can be null for tests.
366   extensions::ExtensionService* extension_service =
367       extensions::ExtensionSystem::Get(profile)->extension_service();
368   if (!extension_service)
369     return;
370   content::TtsController::GetInstance()->AddVoicesChangedDelegate(this);
371   extension_registry_ = extensions::ExtensionRegistry::Get(profile);
372   extension_registry_->AddObserver(this);
373 
374   UpdateTextToSpeechVoiceSearchTags();
375   UpdateTextToSpeechEnginesSearchTags();
376 }
377 
~AccessibilitySection()378 AccessibilitySection::~AccessibilitySection() {
379   content::TtsController::GetInstance()->RemoveVoicesChangedDelegate(this);
380   if (extension_registry_)
381     extension_registry_->RemoveObserver(this);
382 }
383 
AddLoadTimeData(content::WebUIDataSource * html_source)384 void AccessibilitySection::AddLoadTimeData(
385     content::WebUIDataSource* html_source) {
386   static constexpr webui::LocalizedString kLocalizedStrings[] = {
387       {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY},
388       {"a11yWebStore", IDS_SETTINGS_ACCESSIBILITY_WEB_STORE},
389       {"moreFeaturesLinkDescription",
390        IDS_SETTINGS_MORE_FEATURES_LINK_DESCRIPTION},
391       {"accessibleImageLabelsTitle",
392        IDS_SETTINGS_ACCESSIBLE_IMAGE_LABELS_TITLE},
393       {"accessibleImageLabelsSubtitle",
394        IDS_SETTINGS_ACCESSIBLE_IMAGE_LABELS_SUBTITLE},
395       {"settingsSliderRoleDescription",
396        IDS_SETTINGS_SLIDER_MIN_MAX_ARIA_ROLE_DESCRIPTION},
397       {"manageAccessibilityFeatures",
398        IDS_SETTINGS_ACCESSIBILITY_MANAGE_ACCESSIBILITY_FEATURES},
399       {"optionsInMenuLabel", IDS_SETTINGS_OPTIONS_IN_MENU_LABEL},
400       {"largeMouseCursorLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_LABEL},
401       {"largeMouseCursorSizeLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LABEL},
402       {"largeMouseCursorSizeDefaultLabel",
403        IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_DEFAULT_LABEL},
404       {"largeMouseCursorSizeLargeLabel",
405        IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LARGE_LABEL},
406       {"cursorColorOptionsLabel", IDS_SETTINGS_CURSOR_COLOR_OPTIONS_LABEL},
407       {"cursorColorBlack", IDS_SETTINGS_CURSOR_COLOR_BLACK},
408       {"cursorColorRed", IDS_SETTINGS_CURSOR_COLOR_RED},
409       {"cursorColorYellow", IDS_SETTINGS_CURSOR_COLOR_YELLOW},
410       {"cursorColorGreen", IDS_SETTINGS_CURSOR_COLOR_GREEN},
411       {"cursorColorCyan", IDS_SETTINGS_CURSOR_COLOR_CYAN},
412       {"cursorColorBlue", IDS_SETTINGS_CURSOR_COLOR_BLUE},
413       {"cursorColorMagenta", IDS_SETTINGS_CURSOR_COLOR_MAGENTA},
414       {"cursorColorPink", IDS_SETTINGS_CURSOR_COLOR_PINK},
415       {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL},
416       {"stickyKeysLabel", IDS_SETTINGS_STICKY_KEYS_LABEL},
417       {"chromeVoxLabel", IDS_SETTINGS_CHROMEVOX_LABEL},
418       {"chromeVoxOptionsLabel", IDS_SETTINGS_CHROMEVOX_OPTIONS_LABEL},
419       {"screenMagnifierLabel", IDS_SETTINGS_SCREEN_MAGNIFIER_LABEL},
420       {"screenMagnifierFocusFollowingLabel",
421        IDS_SETTINGS_SCREEN_MAGNIFIER_FOCUS_FOLLOWING_LABEL},
422       {"screenMagnifierZoomLabel", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_LABEL},
423       {"dockedMagnifierLabel", IDS_SETTINGS_DOCKED_MAGNIFIER_LABEL},
424       {"dockedMagnifierZoomLabel", IDS_SETTINGS_DOCKED_MAGNIFIER_ZOOM_LABEL},
425       {"screenMagnifierZoom2x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_2_X},
426       {"screenMagnifierZoom4x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_4_X},
427       {"screenMagnifierZoom6x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_6_X},
428       {"screenMagnifierZoom8x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_8_X},
429       {"screenMagnifierZoom10x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_10_X},
430       {"screenMagnifierZoom12x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_12_X},
431       {"screenMagnifierZoom14x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_14_X},
432       {"screenMagnifierZoom16x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_16_X},
433       {"screenMagnifierZoom18x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_18_X},
434       {"screenMagnifierZoom20x", IDS_SETTINGS_SCREEN_MAGNIFIER_ZOOM_20_X},
435       {"tapDraggingLabel", IDS_SETTINGS_TAP_DRAGGING_LABEL},
436       {"clickOnStopLabel", IDS_SETTINGS_CLICK_ON_STOP_LABEL},
437       {"delayBeforeClickLabel", IDS_SETTINGS_DELAY_BEFORE_CLICK_LABEL},
438       {"delayBeforeClickExtremelyShort",
439        IDS_SETTINGS_DELAY_BEFORE_CLICK_EXTREMELY_SHORT},
440       {"delayBeforeClickVeryShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_SHORT},
441       {"delayBeforeClickShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_SHORT},
442       {"delayBeforeClickLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_LONG},
443       {"delayBeforeClickVeryLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_LONG},
444       {"autoclickRevertToLeftClick",
445        IDS_SETTINGS_AUTOCLICK_REVERT_TO_LEFT_CLICK},
446       {"autoclickStabilizeCursorPosition",
447        IDS_SETTINGS_AUTOCLICK_STABILIZE_CURSOR_POSITION},
448       {"autoclickMovementThresholdLabel",
449        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_LABEL},
450       {"autoclickMovementThresholdExtraSmall",
451        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_EXTRA_SMALL},
452       {"autoclickMovementThresholdSmall",
453        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_SMALL},
454       {"autoclickMovementThresholdDefault",
455        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_DEFAULT},
456       {"autoclickMovementThresholdLarge",
457        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_LARGE},
458       {"autoclickMovementThresholdExtraLarge",
459        IDS_SETTINGS_AUTOCLICK_MOVEMENT_THRESHOLD_EXTRA_LARGE},
460       {"dictationDescription",
461        IDS_SETTINGS_ACCESSIBILITY_DICTATION_DESCRIPTION},
462       {"dictationLabel", IDS_SETTINGS_ACCESSIBILITY_DICTATION_LABEL},
463       {"onScreenKeyboardLabel", IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL},
464       {"monoAudioLabel", IDS_SETTINGS_MONO_AUDIO_LABEL},
465       {"startupSoundLabel", IDS_SETTINGS_STARTUP_SOUND_LABEL},
466       {"a11yExplanation", IDS_SETTINGS_ACCESSIBILITY_EXPLANATION},
467       {"caretHighlightLabel",
468        IDS_SETTINGS_ACCESSIBILITY_CARET_HIGHLIGHT_DESCRIPTION},
469       {"cursorHighlightLabel",
470        IDS_SETTINGS_ACCESSIBILITY_CURSOR_HIGHLIGHT_DESCRIPTION},
471       {"focusHighlightLabel",
472        IDS_SETTINGS_ACCESSIBILITY_FOCUS_HIGHLIGHT_DESCRIPTION},
473       {"selectToSpeakTitle", IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_TITLE},
474       {"selectToSpeakDisabledDescription",
475        IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DISABLED_DESCRIPTION},
476       {"selectToSpeakDescription",
477        IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION},
478       {"selectToSpeakDescriptionWithoutKeyboard",
479        IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION_WITHOUT_KEYBOARD},
480       {"selectToSpeakOptionsLabel",
481        IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_OPTIONS_LABEL},
482       {"switchAccessLabel",
483        IDS_SETTINGS_ACCESSIBILITY_SWITCH_ACCESS_DESCRIPTION},
484       {"switchAccessOptionsLabel",
485        IDS_SETTINGS_ACCESSIBILITY_SWITCH_ACCESS_OPTIONS_LABEL},
486       {"manageSwitchAccessSettings",
487        IDS_SETTINGS_MANAGE_SWITCH_ACCESS_SETTINGS},
488       {"switchAssignmentHeading", IDS_SETTINGS_SWITCH_ASSIGNMENT_HEADING},
489       {"switchAssignOptionPlaceholder",
490        IDS_SETTINGS_SWITCH_ASSIGN_OPTION_PLACEHOLDER},
491       {"switchAssignOptionNone", IDS_SETTINGS_SWITCH_ASSIGN_OPTION_NONE},
492       {"switchAssignOptionSpace", IDS_SETTINGS_SWITCH_ASSIGN_OPTION_SPACE},
493       {"switchAssignOptionEnter", IDS_SETTINGS_SWITCH_ASSIGN_OPTION_ENTER},
494       {"assignSelectSwitchLabel", IDS_SETTINGS_ASSIGN_SELECT_SWITCH_LABEL},
495       {"assignNextSwitchLabel", IDS_SETTINGS_ASSIGN_NEXT_SWITCH_LABEL},
496       {"assignPreviousSwitchLabel", IDS_SETTINGS_ASSIGN_PREVIOUS_SWITCH_LABEL},
497       {"switchAccessAutoScanHeading",
498        IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_HEADING},
499       {"switchAccessAutoScanLabel", IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_LABEL},
500       {"switchAccessAutoScanSpeedLabel",
501        IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_SPEED_LABEL},
502       {"switchAccessAutoScanKeyboardSpeedLabel",
503        IDS_SETTINGS_SWITCH_ACCESS_AUTO_SCAN_KEYBOARD_SPEED_LABEL},
504       {"durationInSeconds", IDS_SETTINGS_DURATION_IN_SECONDS},
505       {"manageAccessibilityFeatures",
506        IDS_SETTINGS_ACCESSIBILITY_MANAGE_ACCESSIBILITY_FEATURES},
507       {"textToSpeechHeading",
508        IDS_SETTINGS_ACCESSIBILITY_TEXT_TO_SPEECH_HEADING},
509       {"displayHeading", IDS_SETTINGS_ACCESSIBILITY_DISPLAY_HEADING},
510       {"displaySettingsTitle",
511        IDS_SETTINGS_ACCESSIBILITY_DISPLAY_SETTINGS_TITLE},
512       {"displaySettingsDescription",
513        IDS_SETTINGS_ACCESSIBILITY_DISPLAY_SETTINGS_DESCRIPTION},
514       {"appearanceSettingsTitle",
515        IDS_SETTINGS_ACCESSIBILITY_APPEARANCE_SETTINGS_TITLE},
516       {"appearanceSettingsDescription",
517        IDS_SETTINGS_ACCESSIBILITY_APPEARANCE_SETTINGS_DESCRIPTION},
518       {"keyboardAndTextInputHeading",
519        IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_AND_TEXT_INPUT_HEADING},
520       {"keyboardSettingsTitle",
521        IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE},
522       {"keyboardSettingsDescription",
523        IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_DESCRIPTION},
524       {"mouseAndTouchpadHeading",
525        IDS_SETTINGS_ACCESSIBILITY_MOUSE_AND_TOUCHPAD_HEADING},
526       {"mouseSettingsTitle", IDS_SETTINGS_ACCESSIBILITY_MOUSE_SETTINGS_TITLE},
527       {"mouseSettingsDescription",
528        IDS_SETTINGS_ACCESSIBILITY_MOUSE_SETTINGS_DESCRIPTION},
529       {"audioAndCaptionsHeading",
530        IDS_SETTINGS_ACCESSIBILITY_AUDIO_AND_CAPTIONS_HEADING},
531       {"additionalFeaturesTitle",
532        IDS_SETTINGS_ACCESSIBILITY_ADDITIONAL_FEATURES_TITLE},
533       {"manageTtsSettings", IDS_SETTINGS_MANAGE_TTS_SETTINGS},
534       {"ttsSettingsLinkDescription", IDS_SETTINGS_TTS_LINK_DESCRIPTION},
535       {"textToSpeechVoices", IDS_SETTINGS_TEXT_TO_SPEECH_VOICES},
536       {"textToSpeechNoVoicesMessage",
537        IDS_SETTINGS_TEXT_TO_SPEECH_NO_VOICES_MESSAGE},
538       {"textToSpeechMoreLanguages", IDS_SETTINGS_TEXT_TO_SPEECH_MORE_LANGUAGES},
539       {"textToSpeechProperties", IDS_SETTINGS_TEXT_TO_SPEECH_PROPERTIES},
540       {"textToSpeechRate", IDS_SETTINGS_TEXT_TO_SPEECH_RATE},
541       {"textToSpeechRateMinimumLabel",
542        IDS_SETTINGS_TEXT_TO_SPEECH_RATE_MINIMUM_LABEL},
543       {"textToSpeechRateMaximumLabel",
544        IDS_SETTINGS_TEXT_TO_SPEECH_RATE_MAXIMUM_LABEL},
545       {"textToSpeechPitch", IDS_SETTINGS_TEXT_TO_SPEECH_PITCH},
546       {"textToSpeechPitchMinimumLabel",
547        IDS_SETTINGS_TEXT_TO_SPEECH_PITCH_MINIMUM_LABEL},
548       {"textToSpeechPitchMaximumLabel",
549        IDS_SETTINGS_TEXT_TO_SPEECH_PITCH_MAXIMUM_LABEL},
550       {"textToSpeechVolume", IDS_SETTINGS_TEXT_TO_SPEECH_VOLUME},
551       {"textToSpeechVolumeMinimumLabel",
552        IDS_SETTINGS_TEXT_TO_SPEECH_VOLUME_MINIMUM_LABEL},
553       {"textToSpeechVolumeMaximumLabel",
554        IDS_SETTINGS_TEXT_TO_SPEECH_VOLUME_MAXIMUM_LABEL},
555       {"percentage", IDS_SETTINGS_PERCENTAGE},
556       {"defaultPercentage", IDS_SETTINGS_DEFAULT_PERCENTAGE},
557       {"textToSpeechPreviewHeading",
558        IDS_SETTINGS_TEXT_TO_SPEECH_PREVIEW_HEADING},
559       {"textToSpeechPreviewInputLabel",
560        IDS_SETTINGS_TEXT_TO_SPEECH_PREVIEW_INPUT_LABEL},
561       {"textToSpeechPreviewInput", IDS_SETTINGS_TEXT_TO_SPEECH_PREVIEW_INPUT},
562       {"textToSpeechPreviewVoice", IDS_SETTINGS_TEXT_TO_SPEECH_PREVIEW_VOICE},
563       {"textToSpeechPreviewPlay", IDS_SETTINGS_TEXT_TO_SPEECH_PREVIEW_PLAY},
564       {"textToSpeechEngines", IDS_SETTINGS_TEXT_TO_SPEECH_ENGINES},
565       {"tabletModeShelfNavigationButtonsSettingLabel",
566        IDS_SETTINGS_A11Y_TABLET_MODE_SHELF_BUTTONS_LABEL},
567       {"tabletModeShelfNavigationButtonsSettingDescription",
568        IDS_SETTINGS_A11Y_TABLET_MODE_SHELF_BUTTONS_DESCRIPTION},
569       {"caretBrowsingTitle", IDS_SETTINGS_ENABLE_CARET_BROWSING_TITLE},
570       {"caretBrowsingSubtitle", IDS_SETTINGS_ENABLE_CARET_BROWSING_SUBTITLE},
571   };
572   AddLocalizedStringsBulk(html_source, kLocalizedStrings);
573 
574   html_source->AddString("a11yLearnMoreUrl",
575                          chrome::kChromeAccessibilityHelpURL);
576 
577   html_source->AddBoolean(
578       "showExperimentalAccessibilitySwitchAccessImprovedTextInput",
579       IsSwitchAccessTextAllowed());
580 
581   html_source->AddBoolean("showExperimentalA11yLabels",
582                           AreExperimentalA11yLabelsAllowed());
583 
584   html_source->AddBoolean("showTabletModeShelfNavigationButtonsSettings",
585                           AreTabletNavigationButtonsAllowed());
586 
587   html_source->AddString("tabletModeShelfNavigationButtonsLearnMoreUrl",
588                          chrome::kTabletModeGesturesLearnMoreURL);
589 
590   html_source->AddBoolean("showExperimentalAccessibilityCursorColor",
591                           IsCursorColorAllowed());
592 
593   ::settings::AddCaptionSubpageStrings(html_source);
594 }
595 
AddHandlers(content::WebUI * web_ui)596 void AccessibilitySection::AddHandlers(content::WebUI* web_ui) {
597   web_ui->AddMessageHandler(
598       std::make_unique<::settings::AccessibilityMainHandler>());
599   web_ui->AddMessageHandler(std::make_unique<AccessibilityHandler>(profile()));
600   web_ui->AddMessageHandler(std::make_unique<::settings::TtsHandler>());
601   web_ui->AddMessageHandler(
602       std::make_unique<::settings::FontHandler>(profile()));
603   web_ui->AddMessageHandler(
604       std::make_unique<::settings::CaptionsHandler>(profile()->GetPrefs()));
605 }
606 
GetSectionNameMessageId() const607 int AccessibilitySection::GetSectionNameMessageId() const {
608   return IDS_SETTINGS_ACCESSIBILITY;
609 }
610 
GetSection() const611 mojom::Section AccessibilitySection::GetSection() const {
612   return mojom::Section::kAccessibility;
613 }
614 
GetSectionIcon() const615 mojom::SearchResultIcon AccessibilitySection::GetSectionIcon() const {
616   return mojom::SearchResultIcon::kA11y;
617 }
618 
GetSectionPath() const619 std::string AccessibilitySection::GetSectionPath() const {
620   return mojom::kAccessibilitySectionPath;
621 }
LogMetric(mojom::Setting setting,base::Value & value) const622 bool AccessibilitySection::LogMetric(mojom::Setting setting,
623                                      base::Value& value) const {
624   switch (setting) {
625     case mojom::Setting::kFullscreenMagnifierFocusFollowing:
626       base::UmaHistogramBoolean(
627           "ChromeOS.Settings.Accessibility.FullscreenMagnifierFocusFollowing",
628           value.GetBool());
629       return true;
630 
631     default:
632       return false;
633   }
634 }
635 
RegisterHierarchy(HierarchyGenerator * generator) const636 void AccessibilitySection::RegisterHierarchy(
637     HierarchyGenerator* generator) const {
638   generator->RegisterTopLevelSetting(mojom::Setting::kA11yQuickSettings);
639   generator->RegisterTopLevelSetting(
640       mojom::Setting::kGetImageDescriptionsFromGoogle);
641 
642   // Manage accessibility.
643   generator->RegisterTopLevelSubpage(
644       IDS_SETTINGS_ACCESSIBILITY_MANAGE_ACCESSIBILITY_FEATURES,
645       mojom::Subpage::kManageAccessibility, mojom::SearchResultIcon::kA11y,
646       mojom::SearchResultDefaultRank::kMedium,
647       mojom::kManageAccessibilitySubpagePath);
648   static constexpr mojom::Setting kManageAccessibilitySettings[] = {
649       mojom::Setting::kChromeVox,
650       mojom::Setting::kSelectToSpeak,
651       mojom::Setting::kHighContrastMode,
652       mojom::Setting::kFullscreenMagnifier,
653       mojom::Setting::kFullscreenMagnifierFocusFollowing,
654       mojom::Setting::kDockedMagnifier,
655       mojom::Setting::kStickyKeys,
656       mojom::Setting::kOnScreenKeyboard,
657       mojom::Setting::kDictation,
658       mojom::Setting::kHighlightKeyboardFocus,
659       mojom::Setting::kEnableSwitchAccess,
660       mojom::Setting::kHighlightTextCaret,
661       mojom::Setting::kAutoClickWhenCursorStops,
662       mojom::Setting::kLargeCursor,
663       mojom::Setting::kHighlightCursorWhileMoving,
664       mojom::Setting::kTabletNavigationButtons,
665       mojom::Setting::kMonoAudio,
666       mojom::Setting::kStartupSound,
667       mojom::Setting::kLiveCaptions,
668       mojom::Setting::kEnableCursorColor,
669   };
670   RegisterNestedSettingBulk(mojom::Subpage::kManageAccessibility,
671                             kManageAccessibilitySettings, generator);
672 
673   // Text-to-Speech.
674   generator->RegisterTopLevelSubpage(
675       IDS_SETTINGS_MANAGE_TTS_SETTINGS, mojom::Subpage::kTextToSpeech,
676       mojom::SearchResultIcon::kA11y, mojom::SearchResultDefaultRank::kMedium,
677       mojom::kTextToSpeechSubpagePath);
678   static constexpr mojom::Setting kTextToSpeechSettings[] = {
679       mojom::Setting::kTextToSpeechRate,    mojom::Setting::kTextToSpeechPitch,
680       mojom::Setting::kTextToSpeechVolume,  mojom::Setting::kTextToSpeechVoice,
681       mojom::Setting::kTextToSpeechEngines,
682   };
683   RegisterNestedSettingBulk(mojom::Subpage::kTextToSpeech,
684                             kTextToSpeechSettings, generator);
685 
686   // Switch access.
687   generator->RegisterTopLevelSubpage(IDS_SETTINGS_MANAGE_SWITCH_ACCESS_SETTINGS,
688                                      mojom::Subpage::kSwitchAccessOptions,
689                                      mojom::SearchResultIcon::kA11y,
690                                      mojom::SearchResultDefaultRank::kMedium,
691                                      mojom::kSwitchAccessOptionsSubpagePath);
692   static constexpr mojom::Setting kSwitchAccessSettings[] = {
693       mojom::Setting::kSwitchActionAssignment,
694       mojom::Setting::kSwitchActionAutoScan,
695       mojom::Setting::kSwitchActionAutoScanKeyboard,
696   };
697   RegisterNestedSettingBulk(mojom::Subpage::kSwitchAccessOptions,
698                             kSwitchAccessSettings, generator);
699 
700   // Caption preferences.
701   generator->RegisterTopLevelSubpage(
702       IDS_SETTINGS_CAPTIONS, mojom::Subpage::kCaptions,
703       mojom::SearchResultIcon::kA11y, mojom::SearchResultDefaultRank::kMedium,
704       mojom::kCaptionsSubpagePath);
705 }
706 
OnVoicesChanged()707 void AccessibilitySection::OnVoicesChanged() {
708   UpdateTextToSpeechVoiceSearchTags();
709 }
710 
UpdateTextToSpeechVoiceSearchTags()711 void AccessibilitySection::UpdateTextToSpeechVoiceSearchTags() {
712   // Start with no text-to-speech voice search tags.
713   SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
714   updater.RemoveSearchTags(GetTextToSpeechVoiceSearchConcepts());
715 
716   content::TtsController* tts_controller =
717       content::TtsController::GetInstance();
718   std::vector<content::VoiceData> voices;
719   tts_controller->GetVoices(profile(), &voices);
720   if (!voices.empty()) {
721     updater.AddSearchTags(GetTextToSpeechVoiceSearchConcepts());
722   }
723 }
724 
OnExtensionLoaded(content::BrowserContext * browser_context,const extensions::Extension * extension)725 void AccessibilitySection::OnExtensionLoaded(
726     content::BrowserContext* browser_context,
727     const extensions::Extension* extension) {
728   UpdateTextToSpeechEnginesSearchTags();
729 }
730 
OnExtensionUnloaded(content::BrowserContext * browser_context,const extensions::Extension * extension,extensions::UnloadedExtensionReason reason)731 void AccessibilitySection::OnExtensionUnloaded(
732     content::BrowserContext* browser_context,
733     const extensions::Extension* extension,
734     extensions::UnloadedExtensionReason reason) {
735   UpdateTextToSpeechEnginesSearchTags();
736 }
737 
UpdateTextToSpeechEnginesSearchTags()738 void AccessibilitySection::UpdateTextToSpeechEnginesSearchTags() {
739   // Start with no text-to-speech engines search tags.
740   SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
741   updater.RemoveSearchTags(GetTextToSpeechEnginesSearchConcepts());
742 
743   const std::set<std::string>& extensions =
744       TtsEngineExtensionObserverChromeOS::GetInstance(profile())
745           ->engine_extension_ids();
746   if (!extensions.empty()) {
747     updater.AddSearchTags(GetTextToSpeechEnginesSearchConcepts());
748   }
749 }
750 
UpdateSearchTags()751 void AccessibilitySection::UpdateSearchTags() {
752   SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
753 
754   if (accessibility_state_utils::IsScreenReaderEnabled() &&
755       AreExperimentalA11yLabelsAllowed()) {
756     updater.AddSearchTags(GetA11yLabelsSearchConcepts());
757   } else {
758     updater.RemoveSearchTags(GetA11yLabelsSearchConcepts());
759   }
760 
761   updater.RemoveSearchTags(GetA11ySwitchAccessOnSearchConcepts());
762   updater.RemoveSearchTags(GetA11ySwitchAccessKeyboardSearchConcepts());
763 
764   if (AreLiveCaptionsAllowed()) {
765     updater.AddSearchTags(GetA11yLiveCaptionSearchConcepts());
766   } else {
767     updater.RemoveSearchTags(GetA11yLiveCaptionSearchConcepts());
768   }
769 
770   if (IsCursorColorAllowed()) {
771     updater.AddSearchTags(GetA11yCursorColorSearchConcepts());
772   } else {
773     updater.RemoveSearchTags(GetA11yCursorColorSearchConcepts());
774   }
775 
776   if (!pref_service_->GetBoolean(
777           ash::prefs::kAccessibilitySwitchAccessEnabled)) {
778     return;
779   }
780 
781   updater.AddSearchTags(GetA11ySwitchAccessOnSearchConcepts());
782 
783   if (IsSwitchAccessTextAllowed() &&
784       pref_service_->GetBoolean(
785           ash::prefs::kAccessibilitySwitchAccessAutoScanEnabled)) {
786     updater.AddSearchTags(GetA11ySwitchAccessKeyboardSearchConcepts());
787   }
788 }
789 
790 }  // namespace settings
791 }  // namespace chromeos
792