local_pointer_input_monitor.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 REMOTING_HOST_INPUT_MONITOR_LOCAL_POINTER_INPUT_MONITOR_H_
  5. #define REMOTING_HOST_INPUT_MONITOR_LOCAL_POINTER_INPUT_MONITOR_H_
  6. #include <memory>
  7. #include "base/callback.h"
  8. #include "base/memory/ref_counted.h"
  9. #include "base/memory/weak_ptr.h"
  10. #include "remoting/host/input_monitor/local_input_monitor.h"
  11. namespace base {
  12. class SingleThreadTaskRunner;
  13. } // namespace base
  14. namespace remoting {
  15. // Monitors the local input and sends a notification via the callback passed in
  16. // for every mouse or touch move event received.
  17. class LocalPointerInputMonitor {
  18. public:
  19. virtual ~LocalPointerInputMonitor() = default;
  20. // Creates a platform-specific instance of LocalPointerInputMonitor.
  21. // Callbacks are called on the |caller_task_runner| thread.
  22. // |pointer_event_callback| is called for each pointer event detected.
  23. // |disconnect_callback| is called if monitoring cannot be started.
  24. static std::unique_ptr<LocalPointerInputMonitor> Create(
  25. scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
  26. scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
  27. scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
  28. LocalInputMonitor::PointerMoveCallback pointer_move_callback,
  29. base::OnceClosure disconnect_callback);
  30. protected:
  31. LocalPointerInputMonitor() = default;
  32. };
  33. } // namespace remoting
  34. #endif // REMOTING_HOST_INPUT_MONITOR_LOCAL_POINTER_INPUT_MONITOR_H_