accessibility_focus_ring_controller.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_FOCUS_RING_CONTROLLER_H_
  5. #define ASH_PUBLIC_CPP_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_
  6. #include <string>
  7. #include <vector>
  8. #include "ash/public/cpp/ash_public_export.h"
  9. #include "third_party/skia/include/core/SkColor.h"
  10. namespace gfx {
  11. class Rect;
  12. }
  13. namespace ash {
  14. struct AccessibilityFocusRingInfo;
  15. // Interface to control accessibility focus ring features.
  16. class ASH_PUBLIC_EXPORT AccessibilityFocusRingController {
  17. public:
  18. static AccessibilityFocusRingController* Get();
  19. AccessibilityFocusRingController(const AccessibilityFocusRingController&) =
  20. delete;
  21. AccessibilityFocusRingController& operator=(
  22. const AccessibilityFocusRingController&) = delete;
  23. // Sets the focus ring with the given ID to the specifications of focus_ring.
  24. virtual void SetFocusRing(
  25. const std::string& focus_ring_id,
  26. std::unique_ptr<AccessibilityFocusRingInfo> focus_ring) = 0;
  27. // Hides focus ring on screen with the given ID.
  28. virtual void HideFocusRing(const std::string& focus_ring_id) = 0;
  29. // Draws a highlight at the given rects in screen coordinates. Rects may be
  30. // overlapping and will be merged into one layer. This looks similar to
  31. // selecting a region with the cursor, except it is drawn in the foreground
  32. // rather than behind a text layer.
  33. // TODO(katie): Add |caller_id| to highlights as well if other Accessibility
  34. // tools or extensions want to use this API.
  35. virtual void SetHighlights(const std::vector<gfx::Rect>& rects_in_screen,
  36. SkColor skcolor) = 0;
  37. // Hides highlight on screen.
  38. // TODO(katie): Add |caller_id| to highlights as well.
  39. virtual void HideHighlights() = 0;
  40. protected:
  41. AccessibilityFocusRingController();
  42. virtual ~AccessibilityFocusRingController();
  43. };
  44. } // namespace ash
  45. #endif // ASH_PUBLIC_CPP_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_