event_rewriter_controller.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2018 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_EVENT_REWRITER_CONTROLLER_H_
  5. #define ASH_PUBLIC_CPP_EVENT_REWRITER_CONTROLLER_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ui/chromeos/events/event_rewriter_chromeos.h"
  9. namespace ui {
  10. class Event;
  11. class EventRewriter;
  12. } // namespace ui
  13. namespace ash {
  14. class AccessibilityEventRewriterDelegate;
  15. // Allows clients to toggle some event rewriting behavior.
  16. class ASH_EXPORT EventRewriterController {
  17. public:
  18. // Returns the singleton EventRewriterController instance.
  19. static EventRewriterController* Get();
  20. // Initializes this controller after ash::Shell finishes initialization.
  21. virtual void Initialize(
  22. ui::EventRewriterChromeOS::Delegate* event_rewriter_delegate,
  23. AccessibilityEventRewriterDelegate*
  24. accessibility_event_rewriter_delegate) = 0;
  25. // Takes ownership of |rewriter| and adds it to the current event sources.
  26. virtual void AddEventRewriter(
  27. std::unique_ptr<ui::EventRewriter> rewriter) = 0;
  28. // Enables the KeyboardDrivenEventRewriter, which is disabled by default.
  29. // This only applies when the user is on the login screen.
  30. virtual void SetKeyboardDrivenEventRewriterEnabled(bool enabled) = 0;
  31. // If true, Shift + Arrow keys are rewritten to Tab/Shift-Tab keys.
  32. // This only applies when the KeyboardDrivenEventRewriter is active.
  33. virtual void SetArrowToTabRewritingEnabled(bool enabled) = 0;
  34. // Continue dispatch of key events that were unhandled by ChromeVox.
  35. // TODO(crbug.com/839541): ChromeVox should not repost unhandled events.
  36. virtual void OnUnhandledSpokenFeedbackEvent(
  37. std::unique_ptr<ui::Event> event) = 0;
  38. // Discards key events and sends to spoken feedback when true.
  39. virtual void CaptureAllKeysForSpokenFeedback(bool capture) = 0;
  40. // Sends mouse events to accessibility component extensions when true.
  41. virtual void SetSendMouseEvents(bool value) = 0;
  42. protected:
  43. virtual ~EventRewriterController() {}
  44. };
  45. } // namespace ash
  46. #endif // ASH_PUBLIC_CPP_EVENT_REWRITER_CONTROLLER_H_