accessibility_controller_client.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Copyright 2019 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_PUBLIC_CPP_ACCESSIBILITY_CONTROLLER_CLIENT_H_
  5. #define ASH_PUBLIC_CPP_ACCESSIBILITY_CONTROLLER_CLIENT_H_
  6. #include "ash/public/cpp/ash_public_export.h"
  7. #include "base/time/time.h"
  8. namespace aura {
  9. class Window;
  10. } // namespace aura
  11. namespace ax {
  12. namespace mojom {
  13. enum class Gesture;
  14. } // namespace mojom
  15. } // namespace ax
  16. namespace gfx {
  17. class Point;
  18. class PointF;
  19. class Rect;
  20. } // namespace gfx
  21. namespace ash {
  22. enum class AccessibilityAlert;
  23. enum class SelectToSpeakPanelAction;
  24. enum class Sound;
  25. // Interface for Ash to request accessibility service from its client, Chrome.
  26. class ASH_PUBLIC_EXPORT AccessibilityControllerClient {
  27. public:
  28. // Triggers an accessibility alert to give the user feedback.
  29. virtual void TriggerAccessibilityAlert(AccessibilityAlert alert) = 0;
  30. // Triggers an accessibility alert with the given |message|.
  31. virtual void TriggerAccessibilityAlertWithMessage(
  32. const std::string& message) = 0;
  33. // Plays an earcon. Earcons are brief and distinctive sounds that indicate
  34. // that their mapped event has occurred. The |sound_key| enums can be found in
  35. // chromeos/ash/components/audio/sounds.h. This method exists because the
  36. // browser owns all media playback.
  37. virtual void PlayEarcon(Sound sound_key) = 0;
  38. // Initiates play of shutdown sound and returns sound duration. This method
  39. // exists because the browser owns all media playback.
  40. virtual base::TimeDelta PlayShutdownSound() = 0;
  41. // Forwards an accessibility gesture from the touch exploration controller to
  42. // ChromeVox.
  43. virtual void HandleAccessibilityGesture(ax::mojom::Gesture gesture,
  44. gfx::PointF location) = 0;
  45. // Starts or stops dictation (type what you speak).
  46. // Returns the new dictation state after the toggle.
  47. virtual bool ToggleDictation() = 0;
  48. // Cancels all current and queued speech immediately.
  49. virtual void SilenceSpokenFeedback() = 0;
  50. // Called when we first detect two fingers are held down, which can be used to
  51. // toggle spoken feedback on some touch-only devices.
  52. virtual void OnTwoFingerTouchStart() = 0;
  53. // Called when the user is no longer holding down two fingers (including
  54. // releasing one, holding down three, or moving them).
  55. virtual void OnTwoFingerTouchStop() = 0;
  56. // Whether or not to enable toggling spoken feedback via holding down two
  57. // fingers on the screen.
  58. virtual bool ShouldToggleSpokenFeedbackViaTouch() const = 0;
  59. // Plays tick sound indicating spoken feedback will be toggled after
  60. // countdown.
  61. virtual void PlaySpokenFeedbackToggleCountdown(int tick_count) = 0;
  62. // Requests the Select-to-Speak extension to change its state. This lets users
  63. // do the same things in tablet mode as with a keyboard. Specifically, if
  64. // Select-to-Speak is not speaking, move to capturing state; if
  65. // Select-to-Speak is speaking, cancel speaking and move to inactive state.
  66. virtual void RequestSelectToSpeakStateChange() = 0;
  67. // Requests that the Accessibility Common extension get the nearest scrollable
  68. // bounds to the given point in screen coordinates.
  69. virtual void RequestAutoclickScrollableBoundsForPoint(
  70. gfx::Point& point_in_screen) = 0;
  71. // Dispatches update to Accessibility Common extension when magnifier bounds
  72. // have changed.
  73. virtual void MagnifierBoundsChanged(const gfx::Rect& bounds_in_screen) = 0;
  74. // Called when Switch Access is fully disabled by the user accepting the
  75. // disable dialog. Switch Access must be left running when the pref changes
  76. // and before the disable dialog is accepted, so that users can use Switch
  77. // Access to cancel or accept the dialog.
  78. virtual void OnSwitchAccessDisabled() = 0;
  79. // Called when an action occurs (such as button click) on the Select-to-speak
  80. // floating control panel, with an optional value.
  81. virtual void OnSelectToSpeakPanelAction(SelectToSpeakPanelAction action,
  82. double value) = 0;
  83. virtual void SetA11yOverrideWindow(aura::Window* a11y_override_window) = 0;
  84. };
  85. } // namespace ash
  86. #endif // ASH_PUBLIC_CPP_ACCESSIBILITY_CONTROLLER_CLIENT_H_