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.
5 #ifndef REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_
6 #define REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
12 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
16 class DesktopSessionProxy
;
18 // Routes webrtc::MouseCursorMonitor calls through the IPC channel to the
19 // desktop session agent running in the desktop integration process.
20 class IpcMouseCursorMonitor
: public webrtc::MouseCursorMonitor
{
22 explicit IpcMouseCursorMonitor(
23 scoped_refptr
<DesktopSessionProxy
> desktop_session_proxy
);
24 virtual ~IpcMouseCursorMonitor();
26 // webrtc::MouseCursorMonitor interface.
27 virtual void Init(Callback
* callback
, Mode mode
) OVERRIDE
;
28 virtual void Capture() OVERRIDE
;
30 // Called when the cursor shape has changed.
31 void OnMouseCursor(scoped_ptr
<webrtc::MouseCursor
> cursor
);
34 // The callback passed to |webrtc::MouseCursorMonitor::Init()|.
35 webrtc::MouseCursorMonitor::Callback
* callback_
;
37 // Wraps the IPC channel to the desktop session agent.
38 scoped_refptr
<DesktopSessionProxy
> desktop_session_proxy_
;
40 // Used to cancel tasks pending on the capturer when it is stopped.
41 base::WeakPtrFactory
<IpcMouseCursorMonitor
> weak_factory_
;
43 DISALLOW_COPY_AND_ASSIGN(IpcMouseCursorMonitor
);
46 } // namespace remoting
48 #endif // REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_