desktop_and_cursor_composer_notifier.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2021 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 REMOTING_HOST_DESKTOP_AND_CURSOR_COMPOSER_NOTIFIER_H_
  5. #define REMOTING_HOST_DESKTOP_AND_CURSOR_COMPOSER_NOTIFIER_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "remoting/protocol/input_filter.h"
  8. namespace remoting {
  9. // Non-filtering InputStub implementation which detects changes into or out of
  10. // relative pointer mode, which corresponds to client-side pointer lock. Coupled
  11. // with a local input monitor detecting local mouse activity, this can be used
  12. // to enable or disable compositing of the local mouse cursor.
  13. class DesktopAndCursorComposerNotifier : public protocol::InputFilter {
  14. public:
  15. class EventHandler {
  16. public:
  17. virtual void SetComposeEnabled(bool enabled) = 0;
  18. };
  19. DesktopAndCursorComposerNotifier(InputStub* input_stub,
  20. EventHandler* event_handler_);
  21. DesktopAndCursorComposerNotifier(const DesktopAndCursorComposerNotifier&) =
  22. delete;
  23. DesktopAndCursorComposerNotifier& operator=(
  24. const DesktopAndCursorComposerNotifier&) = delete;
  25. ~DesktopAndCursorComposerNotifier() override;
  26. // InputStub overrides.
  27. void InjectMouseEvent(const protocol::MouseEvent& event) override;
  28. void OnLocalInput();
  29. private:
  30. void NotifyEventHandler(bool enabled);
  31. raw_ptr<EventHandler> event_handler_;
  32. bool has_triggered_ = false;
  33. bool is_enabled_ = false;
  34. };
  35. } // namespace remoting
  36. #endif // REMOTING_HOST_DESKTOP_AND_CURSOR_COMPOSER_NOTIFIER_H_