ipc_mouse_cursor_monitor.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2014 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_IPC_MOUSE_CURSOR_MONITOR_H_
  5. #define REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_
  6. #include <memory>
  7. #include "base/memory/raw_ptr.h"
  8. #include "base/memory/ref_counted.h"
  9. #include "base/memory/weak_ptr.h"
  10. #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
  11. #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
  12. namespace remoting {
  13. class DesktopSessionProxy;
  14. // Routes webrtc::MouseCursorMonitor calls through the IPC channel to the
  15. // desktop session agent running in the desktop integration process.
  16. class IpcMouseCursorMonitor : public webrtc::MouseCursorMonitor {
  17. public:
  18. explicit IpcMouseCursorMonitor(
  19. scoped_refptr<DesktopSessionProxy> desktop_session_proxy);
  20. IpcMouseCursorMonitor(const IpcMouseCursorMonitor&) = delete;
  21. IpcMouseCursorMonitor& operator=(const IpcMouseCursorMonitor&) = delete;
  22. ~IpcMouseCursorMonitor() override;
  23. // webrtc::MouseCursorMonitor interface.
  24. void Init(Callback* callback, Mode mode) override;
  25. void Capture() override;
  26. // Called when the cursor shape has changed.
  27. void OnMouseCursor(std::unique_ptr<webrtc::MouseCursor> cursor);
  28. private:
  29. // The callback passed to |webrtc::MouseCursorMonitor::Init()|.
  30. raw_ptr<webrtc::MouseCursorMonitor::Callback> callback_;
  31. // Wraps the IPC channel to the desktop session agent.
  32. scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;
  33. // Used to cancel tasks pending on the capturer when it is stopped.
  34. base::WeakPtrFactory<IpcMouseCursorMonitor> weak_factory_{this};
  35. };
  36. } // namespace remoting
  37. #endif // REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_