accessibility_controller_impl.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. // Copyright 2017 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. #ifndef ASH_ACCESSIBILITY_ACCESSIBILITY_CONTROLLER_IMPL_H_
  5. #define ASH_ACCESSIBILITY_ACCESSIBILITY_CONTROLLER_IMPL_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/constants/ash_constants.h"
  9. #include "ash/public/cpp/accessibility_controller.h"
  10. #include "ash/public/cpp/session/session_observer.h"
  11. #include "ash/public/cpp/tablet_mode_observer.h"
  12. #include "base/callback_forward.h"
  13. #include "base/memory/weak_ptr.h"
  14. #include "base/observer_list.h"
  15. #include "base/time/time.h"
  16. class PrefChangeRegistrar;
  17. class PrefRegistrySimple;
  18. class PrefService;
  19. namespace aura {
  20. class Window;
  21. } // namespace aura
  22. namespace ax {
  23. namespace mojom {
  24. enum class Gesture;
  25. } // namespace mojom
  26. } // namespace ax
  27. namespace gfx {
  28. class Point;
  29. class PointF;
  30. struct VectorIcon;
  31. } // namespace gfx
  32. namespace ash {
  33. class AccessibilityConfirmationDialog;
  34. class AccessibilityEventRewriter;
  35. class AccessibilityHighlightController;
  36. class AccessibilityObserver;
  37. class DictationBubbleController;
  38. class DictationNudgeController;
  39. class FloatingAccessibilityController;
  40. class PointScanController;
  41. class ScopedBacklightsForcedOff;
  42. class SelectToSpeakEventHandler;
  43. class SelectToSpeakMenuBubbleController;
  44. class SwitchAccessMenuBubbleController;
  45. enum class Sound;
  46. enum AccessibilityNotificationVisibility {
  47. A11Y_NOTIFICATION_NONE,
  48. A11Y_NOTIFICATION_SHOW,
  49. };
  50. // Used to indicate which accessibility notification should be shown.
  51. enum class A11yNotificationType {
  52. // No accessibility notification.
  53. kNone,
  54. // Shown when spoken feedback is set enabled with A11Y_NOTIFICATION_SHOW.
  55. kSpokenFeedbackEnabled,
  56. // Shown when braille display is connected while spoken feedback is enabled.
  57. kBrailleDisplayConnected,
  58. // Shown when braille display is connected while spoken feedback is not
  59. // enabled yet. Note: in this case braille display connected would enable
  60. // spoken feedback.
  61. kSpokenFeedbackBrailleEnabled,
  62. // Shown when Switch Access is enabled.
  63. kSwitchAccessEnabled,
  64. // Shown when speech recognition files download successfully.
  65. kSpeechRecognitionFilesDownloaded,
  66. // Shown when speech recognition files download fails.
  67. kSpeechRecognitionFilesFailed,
  68. };
  69. // The controller for accessibility features in ash. Features can be enabled
  70. // in chrome's webui settings or the system tray menu (see TrayAccessibility).
  71. // Uses preferences to communicate with chrome to support mash.
  72. class ASH_EXPORT AccessibilityControllerImpl : public AccessibilityController,
  73. public SessionObserver,
  74. public TabletModeObserver {
  75. public:
  76. enum FeatureType {
  77. kAutoclick = 0,
  78. kCaretHighlight,
  79. kCursorColor,
  80. kCursorHighlight,
  81. kDictation,
  82. kDockedMagnifier,
  83. kFloatingMenu,
  84. kFocusHighlight,
  85. kFullscreenMagnifier,
  86. kHighContrast,
  87. kLargeCursor,
  88. kLiveCaption,
  89. kMonoAudio,
  90. kSelectToSpeak,
  91. kSpokenFeedback,
  92. kStickyKeys,
  93. kSwitchAccess,
  94. kVirtualKeyboard,
  95. kFeatureCount,
  96. kNoConflictingFeature
  97. };
  98. // Common interface for all features.
  99. class Feature {
  100. public:
  101. Feature(FeatureType type,
  102. const std::string& pref_name,
  103. const gfx::VectorIcon* icon,
  104. AccessibilityControllerImpl* controller);
  105. Feature(const Feature&) = delete;
  106. Feature& operator=(Feature const&) = delete;
  107. virtual ~Feature();
  108. FeatureType type() const { return type_; }
  109. // Tries to set the feature to |enabled| by setting the user pref.
  110. // Setting feature to be enabled can fail in following conditions:
  111. // - there is a higher priority pref(managed), which overrides this value.
  112. // - there is an other feature, which conflicts with the current one.
  113. virtual void SetEnabled(bool enabled);
  114. bool enabled() const { return enabled_; }
  115. bool IsVisibleInTray() const;
  116. bool IsEnterpriseIconVisible() const;
  117. const std::string& pref_name() const { return pref_name_; }
  118. const gfx::VectorIcon& icon() const;
  119. void UpdateFromPref();
  120. void SetConflictingFeature(FeatureType feature);
  121. protected:
  122. const FeatureType type_;
  123. // Some features cannot be enabled while others are on. When a conflicting
  124. // feature is enabled, we cannot enable current feature.
  125. FeatureType conflicting_feature_ = FeatureType::kNoConflictingFeature;
  126. bool enabled_ = false;
  127. const std::string pref_name_;
  128. const gfx::VectorIcon* icon_;
  129. AccessibilityControllerImpl* const owner_;
  130. };
  131. // Helper struct to store information about a11y dialog -- pref name, resource
  132. // ids for title and body. Also stores the information whether this dialog is
  133. // mandatory for every SetEnabled call.
  134. struct Dialog {
  135. std::string pref_name;
  136. int title_resource_id;
  137. int body_resource_id;
  138. // Whether this dialog should be shown on every SetEnabled action.
  139. bool mandatory;
  140. };
  141. // Some features have confirmation dialog associated with them.
  142. // Dialog can be applied for all SetEnabled() actions, or only to ones
  143. // associated with accelerators.
  144. class FeatureWithDialog : public Feature {
  145. public:
  146. FeatureWithDialog(FeatureType type,
  147. const std::string& pref_name,
  148. const gfx::VectorIcon* icon,
  149. const Dialog& dialog,
  150. AccessibilityControllerImpl* controller);
  151. ~FeatureWithDialog() override;
  152. // Tries to set the feature enabled, if its dialog is mandatory, shows the
  153. // dailog for the first time feature is enabled.
  154. void SetEnabled(bool enabled) override;
  155. // If the dialog have not been accepted, we show it. When it is accepted, we
  156. // call SetEnabled() and invoke |completion_callback|.
  157. void SetEnabledWithDialog(bool enabled,
  158. base::OnceClosure completion_callback);
  159. void SetDialogAccepted();
  160. bool WasDialogAccepted() const;
  161. private:
  162. Dialog dialog_;
  163. };
  164. // Contains data used to give an accessibility-related notification.
  165. struct A11yNotificationWrapper {
  166. A11yNotificationWrapper();
  167. A11yNotificationWrapper(A11yNotificationType type_in,
  168. std::vector<std::u16string> replacements_in);
  169. ~A11yNotificationWrapper();
  170. A11yNotificationWrapper(const A11yNotificationWrapper&);
  171. A11yNotificationType type = A11yNotificationType::kNone;
  172. std::vector<std::u16string> replacements;
  173. };
  174. AccessibilityControllerImpl();
  175. AccessibilityControllerImpl(const AccessibilityControllerImpl&) = delete;
  176. AccessibilityControllerImpl& operator=(const AccessibilityControllerImpl&) =
  177. delete;
  178. ~AccessibilityControllerImpl() override;
  179. // See Shell::RegisterProfilePrefs().
  180. static void RegisterProfilePrefs(PrefRegistrySimple* registry);
  181. void Shutdown();
  182. void AddObserver(AccessibilityObserver* observer);
  183. void RemoveObserver(AccessibilityObserver* observer);
  184. Feature& GetFeature(FeatureType feature) const;
  185. base::WeakPtr<AccessibilityControllerImpl> GetWeakPtr();
  186. // Getters for the corresponding features.
  187. Feature& autoclick() const;
  188. Feature& caret_highlight() const;
  189. Feature& cursor_highlight() const;
  190. Feature& dictation() const;
  191. Feature& floating_menu() const;
  192. Feature& focus_highlight() const;
  193. FeatureWithDialog& fullscreen_magnifier() const;
  194. FeatureWithDialog& docked_magnifier() const;
  195. FeatureWithDialog& high_contrast() const;
  196. Feature& large_cursor() const;
  197. Feature& live_caption() const;
  198. Feature& mono_audio() const;
  199. Feature& spoken_feedback() const;
  200. Feature& select_to_speak() const;
  201. Feature& sticky_keys() const;
  202. Feature& switch_access() const;
  203. Feature& virtual_keyboard() const;
  204. Feature& cursor_color() const;
  205. void SetDisplayRotationAcceleratorDialogBeenAccepted();
  206. bool HasDisplayRotationAcceleratorDialogBeenAccepted() const;
  207. bool IsAutoclickSettingVisibleInTray();
  208. bool IsEnterpriseIconVisibleForAutoclick();
  209. void SetAutoclickEventType(AutoclickEventType event_type);
  210. AutoclickEventType GetAutoclickEventType();
  211. void SetAutoclickMenuPosition(FloatingMenuPosition position);
  212. FloatingMenuPosition GetAutoclickMenuPosition();
  213. void RequestAutoclickScrollableBoundsForPoint(gfx::Point& point_in_screen);
  214. void MagnifierBoundsChanged(const gfx::Rect& bounds_in_screen);
  215. void SetFloatingMenuPosition(FloatingMenuPosition position);
  216. FloatingMenuPosition GetFloatingMenuPosition();
  217. FloatingAccessibilityController* GetFloatingMenuController();
  218. PointScanController* GetPointScanController();
  219. // Update the autoclick menu bounds and sticky keys overlay bounds if
  220. // necessary. This may need to happen when the display work area changes, or
  221. // if system UI regions change (like the virtual keyboard position).
  222. void UpdateFloatingPanelBoundsIfNeeded();
  223. // Update the autoclick menu bounds if necessary. This may need to happen when
  224. // the display work area changes, or if system UI regions change (like the
  225. // virtual keyboard position).
  226. void UpdateAutoclickMenuBoundsIfNeeded();
  227. bool IsCaretHighlightSettingVisibleInTray();
  228. bool IsEnterpriseIconVisibleForCaretHighlight();
  229. bool IsCursorHighlightSettingVisibleInTray();
  230. bool IsEnterpriseIconVisibleForCursorHighlight();
  231. bool IsDictationSettingVisibleInTray();
  232. bool IsEnterpriseIconVisibleForDictation();
  233. bool IsFocusHighlightSettingVisibleInTray();
  234. bool IsEnterpriseIconVisibleForFocusHighlight();
  235. bool IsFullScreenMagnifierSettingVisibleInTray();
  236. bool IsEnterpriseIconVisibleForFullScreenMagnifier();
  237. bool IsDockedMagnifierSettingVisibleInTray();
  238. bool IsEnterpriseIconVisibleForDockedMagnifier();
  239. bool IsHighContrastSettingVisibleInTray();
  240. bool IsEnterpriseIconVisibleForHighContrast();
  241. bool IsLargeCursorSettingVisibleInTray();
  242. bool IsEnterpriseIconVisibleForLargeCursor();
  243. bool IsLiveCaptionSettingVisibleInTray();
  244. bool IsEnterpriseIconVisibleForLiveCaption();
  245. bool IsMonoAudioSettingVisibleInTray();
  246. bool IsEnterpriseIconVisibleForMonoAudio();
  247. void SetSpokenFeedbackEnabled(bool enabled,
  248. AccessibilityNotificationVisibility notify);
  249. bool IsSpokenFeedbackSettingVisibleInTray();
  250. bool IsEnterpriseIconVisibleForSpokenFeedback();
  251. bool IsSelectToSpeakSettingVisibleInTray();
  252. bool IsEnterpriseIconVisibleForSelectToSpeak();
  253. void RequestSelectToSpeakStateChange();
  254. SelectToSpeakState GetSelectToSpeakState() const;
  255. bool IsStickyKeysSettingVisibleInTray();
  256. bool IsEnterpriseIconVisibleForStickyKeys();
  257. // Switch access may be disabled in prefs but still running when the disable
  258. // dialog is displaying.
  259. bool IsSwitchAccessRunning() const;
  260. bool IsSwitchAccessSettingVisibleInTray();
  261. bool IsEnterpriseIconVisibleForSwitchAccess();
  262. void SetAccessibilityEventRewriter(
  263. AccessibilityEventRewriter* accessibility_event_rewriter);
  264. bool IsPointScanEnabled();
  265. bool IsVirtualKeyboardSettingVisibleInTray();
  266. bool IsEnterpriseIconVisibleForVirtualKeyboard();
  267. void SetTabletModeShelfNavigationButtonsEnabled(bool enabled);
  268. bool tablet_mode_shelf_navigation_buttons_enabled() const {
  269. return tablet_mode_shelf_navigation_buttons_enabled_;
  270. }
  271. void ShowFloatingMenuIfEnabled() override;
  272. bool dictation_active() const { return dictation_active_; }
  273. // Returns true if accessibility shortcuts have been disabled.
  274. bool accessibility_shortcuts_enabled() const { return shortcuts_enabled_; }
  275. // Triggers an accessibility alert to give the user feedback.
  276. void TriggerAccessibilityAlert(AccessibilityAlert alert);
  277. // Triggers an accessibility alert with the given |message|.
  278. void TriggerAccessibilityAlertWithMessage(const std::string& message);
  279. // Plays an earcon. Earcons are brief and distinctive sounds that indicate
  280. // that their mapped event has occurred. The |sound_key| enums can be found in
  281. // chromeos/ash/components/audio/sounds.h.
  282. void PlayEarcon(Sound sound_key);
  283. // Initiates play of shutdown sound. Returns the TimeDelta duration.
  284. base::TimeDelta PlayShutdownSound();
  285. // Forwards an accessibility gesture from the touch exploration controller to
  286. // ChromeVox.
  287. void HandleAccessibilityGesture(ax::mojom::Gesture gesture,
  288. gfx::PointF location);
  289. // Toggle dictation.
  290. void ToggleDictation();
  291. // Called when we first detect two fingers are held down, which can be used to
  292. // toggle spoken feedback on some touch-only devices.
  293. void OnTwoFingerTouchStart();
  294. // Called when the user is no longer holding down two fingers (including
  295. // releasing one, holding down three, or moving them).
  296. void OnTwoFingerTouchStop();
  297. // Whether or not to enable toggling spoken feedback via holding down two
  298. // fingers on the screen.
  299. bool ShouldToggleSpokenFeedbackViaTouch() const;
  300. // Plays tick sound indicating spoken feedback will be toggled after
  301. // countdown.
  302. void PlaySpokenFeedbackToggleCountdown(int tick_count);
  303. // Returns true if that accessibility feature pref |path| is being controlled
  304. // by a policy and false otherwise.
  305. bool IsEnterpriseIconVisibleInTrayMenu(const std::string& path);
  306. // Returns true if at least one of the primary settings of the accessibility
  307. // features is going to be visible in the accessibility tray menu.
  308. bool IsPrimarySettingsViewVisibleInTray();
  309. // Returns true if at least one of the additional settings of the
  310. // accessibility features is going to be visible in the accessibility tray
  311. // menu.
  312. bool IsAdditionalSettingsViewVisibleInTray();
  313. // Returns true if there exist one of the additional accessibility features
  314. // and one of the primary accessibility features which are going to visible on
  315. // accessibility tray menu.
  316. bool IsAdditionalSettingsSeparatorVisibleInTray();
  317. // Starts point scanning, to select a point onscreen without using a mouse
  318. // (as used by Switch Access).
  319. void StartPointScanning();
  320. // Sets a window to take a11y focus. This is for windows that need to work
  321. // with accessibility clients that consume accessibility APIs, but cannot take
  322. // real focus themselves. This is meant for temporary UIs, such as capture
  323. // mode and should be set back to null when exiting those UIs, so a11y can
  324. // focus windows with real focus. Destroying |a11y_override_window| will also
  325. // set the a11y override window back to null.
  326. void SetA11yOverrideWindow(aura::Window* a11y_override_window);
  327. // AccessibilityController:
  328. void SetClient(AccessibilityControllerClient* client) override;
  329. void SetDarkenScreen(bool darken) override;
  330. void BrailleDisplayStateChanged(bool connected) override;
  331. void SetFocusHighlightRect(const gfx::Rect& bounds_in_screen) override;
  332. void SetCaretBounds(const gfx::Rect& bounds_in_screen) override;
  333. void SetAccessibilityPanelAlwaysVisible(bool always_visible) override;
  334. void SetAccessibilityPanelBounds(const gfx::Rect& bounds,
  335. AccessibilityPanelState state) override;
  336. void SetSelectToSpeakState(SelectToSpeakState state) override;
  337. void SetSelectToSpeakEventHandlerDelegate(
  338. SelectToSpeakEventHandlerDelegate* delegate) override;
  339. void ShowSelectToSpeakPanel(const gfx::Rect& anchor,
  340. bool is_paused,
  341. double speech_rate) override;
  342. void HideSelectToSpeakPanel() override;
  343. void OnSelectToSpeakPanelAction(SelectToSpeakPanelAction action,
  344. double value) override;
  345. void HideSwitchAccessBackButton() override;
  346. void HideSwitchAccessMenu() override;
  347. void ShowSwitchAccessBackButton(const gfx::Rect& anchor) override;
  348. void ShowSwitchAccessMenu(const gfx::Rect& anchor,
  349. std::vector<std::string> actions_to_show) override;
  350. void StartPointScan() override;
  351. void StopPointScan() override;
  352. void SetPointScanSpeedDipsPerSecond(
  353. int point_scan_speed_dips_per_second) override;
  354. void SetDictationActive(bool is_active) override;
  355. void ToggleDictationFromSource(DictationToggleSource source) override;
  356. void ShowDictationLanguageUpgradedNudge(
  357. const std::string& dictation_locale,
  358. const std::string& application_locale) override;
  359. void HandleAutoclickScrollableBoundsFound(
  360. gfx::Rect& bounds_in_screen) override;
  361. std::u16string GetBatteryDescription() const override;
  362. void SetVirtualKeyboardVisible(bool is_visible) override;
  363. void PerformAcceleratorAction(AcceleratorAction accelerator_action) override;
  364. void NotifyAccessibilityStatusChanged() override;
  365. bool IsAccessibilityFeatureVisibleInTrayMenu(
  366. const std::string& path) override;
  367. void DisablePolicyRecommendationRestorerForTesting() override;
  368. void SuspendSwitchAccessKeyHandling(bool suspend) override;
  369. void EnableChromeVoxVolumeSlideGesture() override;
  370. void ShowConfirmationDialog(const std::u16string& title,
  371. const std::u16string& description,
  372. base::OnceClosure on_accept_callback,
  373. base::OnceClosure on_cancel_callback,
  374. base::OnceClosure on_close_callback) override;
  375. void UpdateDictationButtonOnSpeechRecognitionDownloadChanged(
  376. int download_progress) override;
  377. void ShowSpeechRecognitionDownloadNotificationForDictation(
  378. bool succeeded,
  379. const std::u16string& display_language) override;
  380. void UpdateDictationBubble(
  381. bool visible,
  382. DictationBubbleIconType icon,
  383. const absl::optional<std::u16string>& text,
  384. const absl::optional<std::vector<DictationBubbleHintType>>& hints)
  385. override;
  386. void SilenceSpokenFeedback() override;
  387. // SessionObserver:
  388. void OnSigninScreenPrefServiceInitialized(PrefService* prefs) override;
  389. void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
  390. void OnSessionStateChanged(session_manager::SessionState state) override;
  391. // Test helpers:
  392. AccessibilityEventRewriter* GetAccessibilityEventRewriterForTest();
  393. SwitchAccessMenuBubbleController* GetSwitchAccessBubbleControllerForTest() {
  394. return switch_access_bubble_controller_.get();
  395. }
  396. void DisableSwitchAccessDisableConfirmationDialogTesting() override;
  397. SelectToSpeakMenuBubbleController*
  398. GetSelectToSpeakMenuBubbleControllerForTest() {
  399. return select_to_speak_bubble_controller_.get();
  400. }
  401. AccessibilityConfirmationDialog* GetConfirmationDialogForTest() {
  402. return confirmation_dialog_.get();
  403. }
  404. bool enable_chromevox_volume_slide_gesture() {
  405. return enable_chromevox_volume_slide_gesture_;
  406. }
  407. DictationNudgeController* GetDictationNudgeControllerForTest() {
  408. return dictation_nudge_controller_.get();
  409. }
  410. int dictation_soda_download_progress() {
  411. return dictation_soda_download_progress_;
  412. }
  413. DictationBubbleController* GetDictationBubbleControllerForTest();
  414. private:
  415. // Populate |features_| with the feature of the correct type.
  416. void CreateAccessibilityFeatures();
  417. // Propagates the state of |feature| according to |feature->enabled()|.
  418. void OnFeatureChanged(FeatureType feature);
  419. // TabletModeObserver:
  420. void OnTabletModeStarted() override;
  421. void OnTabletModeEnded() override;
  422. // Observes either the signin screen prefs or active user prefs and loads
  423. // initial settings.
  424. void ObservePrefs(PrefService* prefs);
  425. // Updates the actual feature status based on the prefs value.
  426. void UpdateFeatureFromPref(FeatureType feature);
  427. void UpdateAutoclickDelayFromPref();
  428. void UpdateAutoclickEventTypeFromPref();
  429. void UpdateAutoclickRevertToLeftClickFromPref();
  430. void UpdateAutoclickStabilizePositionFromPref();
  431. void UpdateAutoclickMovementThresholdFromPref();
  432. void UpdateAutoclickMenuPositionFromPref();
  433. void UpdateFloatingMenuPositionFromPref();
  434. void UpdateLargeCursorFromPref();
  435. void UpdateLiveCaptionFromPref();
  436. void UpdateCursorColorFromPrefs();
  437. void UpdateSwitchAccessKeyCodesFromPref(SwitchAccessCommand command);
  438. void UpdateSwitchAccessAutoScanEnabledFromPref();
  439. void UpdateSwitchAccessAutoScanSpeedFromPref();
  440. void UpdateSwitchAccessAutoScanKeyboardSpeedFromPref();
  441. void UpdateSwitchAccessPointScanSpeedFromPref();
  442. void UpdateAccessibilityHighlightingFromPrefs();
  443. void UpdateShortcutsEnabledFromPref();
  444. void UpdateTabletModeShelfNavigationButtonsFromPref();
  445. void SwitchAccessDisableDialogClosed(bool disable_dialog_accepted);
  446. void MaybeCreateSelectToSpeakEventHandler();
  447. void ActivateSwitchAccess();
  448. void DeactivateSwitchAccess();
  449. void SyncSwitchAccessPrefsToSignInProfile();
  450. void UpdateKeyCodesAfterSwitchAccessEnabled();
  451. // Dictation's SODA download progress. Values are between 0 and 100. Tracked
  452. // for testing purposes only.
  453. int dictation_soda_download_progress_ = 0;
  454. // Client interface in chrome browser.
  455. AccessibilityControllerClient* client_ = nullptr;
  456. std::unique_ptr<Feature> features_[kFeatureCount];
  457. base::TimeDelta autoclick_delay_;
  458. int large_cursor_size_in_dip_ = kDefaultLargeCursorSize;
  459. bool dictation_active_ = false;
  460. bool shortcuts_enabled_ = true;
  461. bool tablet_mode_shelf_navigation_buttons_enabled_ = false;
  462. SelectToSpeakState select_to_speak_state_ =
  463. SelectToSpeakState::kSelectToSpeakStateInactive;
  464. std::unique_ptr<SelectToSpeakEventHandler> select_to_speak_event_handler_;
  465. SelectToSpeakEventHandlerDelegate* select_to_speak_event_handler_delegate_ =
  466. nullptr;
  467. std::unique_ptr<SelectToSpeakMenuBubbleController>
  468. select_to_speak_bubble_controller_;
  469. // List of key codes that Switch Access should capture.
  470. std::vector<int> switch_access_keys_to_capture_;
  471. std::unique_ptr<SwitchAccessMenuBubbleController>
  472. switch_access_bubble_controller_;
  473. AccessibilityEventRewriter* accessibility_event_rewriter_ = nullptr;
  474. bool no_switch_access_disable_confirmation_dialog_for_testing_ = false;
  475. bool switch_access_disable_dialog_showing_ = false;
  476. bool skip_switch_access_notification_ = false;
  477. // Used to control the highlights of caret, cursor and focus.
  478. std::unique_ptr<AccessibilityHighlightController>
  479. accessibility_highlight_controller_;
  480. // Used to display accessibility floating menu.
  481. std::unique_ptr<FloatingAccessibilityController> floating_menu_controller_;
  482. // By default, floating accessibility menu is not shown unless
  483. // ShowFloatingMenuIfEnabled() is called. This is used in kiosk mode to
  484. // postpone the showing of the menu till the splash screen closes. This value
  485. // makes floating menu visible as soon as it is enabled.
  486. bool always_show_floating_menu_when_enabled_ = false;
  487. // Used to control point scanning, or selecting a point onscreen without using
  488. // a mouse (as done by Switch Access).
  489. std::unique_ptr<PointScanController> point_scan_controller_;
  490. // Used to force the backlights off to darken the screen.
  491. std::unique_ptr<ScopedBacklightsForcedOff> scoped_backlights_forced_off_;
  492. // Used to show the offline dictation language upgrade nudge. This is created
  493. // with ShowDictationLanguageUpgradedNudge() and reset at Shutdown() or when
  494. // the Dictation feature is disabled.
  495. std::unique_ptr<DictationNudgeController> dictation_nudge_controller_;
  496. // Used to control the Dictation bubble UI.
  497. std::unique_ptr<DictationBubbleController> dictation_bubble_controller_;
  498. // True if ChromeVox should enable its volume slide gesture.
  499. bool enable_chromevox_volume_slide_gesture_ = false;
  500. base::ObserverList<AccessibilityObserver> observers_;
  501. // The pref service of the currently active user or the signin profile before
  502. // user logs in. Can be null in ash_unittests.
  503. PrefService* active_user_prefs_ = nullptr;
  504. // This has to be the first one to be destroyed so we don't get updates about
  505. // any prefs during destruction.
  506. std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
  507. // The current AccessibilityConfirmationDialog, if one exists.
  508. base::WeakPtr<AccessibilityConfirmationDialog> confirmation_dialog_;
  509. base::WeakPtrFactory<AccessibilityControllerImpl> weak_ptr_factory_{this};
  510. };
  511. } // namespace ash
  512. #endif // ASH_ACCESSIBILITY_ACCESSIBILITY_CONTROLLER_IMPL_H_