Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / remoting / host / ipc_mouse_cursor_monitor.cc
blob7df56db7a72b28047712cc7d4a5f3b2368080ff6
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 #include "remoting/host/ipc_mouse_cursor_monitor.h"
7 #include "remoting/host/desktop_session_proxy.h"
8 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
10 namespace remoting {
12 IpcMouseCursorMonitor::IpcMouseCursorMonitor(
13 scoped_refptr<DesktopSessionProxy> desktop_session_proxy)
14 : callback_(nullptr),
15 desktop_session_proxy_(desktop_session_proxy),
16 weak_factory_(this) {
19 IpcMouseCursorMonitor::~IpcMouseCursorMonitor() {}
21 void IpcMouseCursorMonitor::Init(Callback* callback, Mode mode) {
22 DCHECK(!callback_);
23 DCHECK(callback);
24 DCHECK_EQ(webrtc::MouseCursorMonitor::SHAPE_ONLY, mode);
25 callback_ = callback;
26 desktop_session_proxy_->SetMouseCursorMonitor(weak_factory_.GetWeakPtr());
29 void IpcMouseCursorMonitor::Capture() {
30 // Ignore. DesktopSessionAgent will capture the cursor at the same time it
31 // captures a screen frame when |IpcVideoFrameCapturer::Capture()| is called.
32 // This saves an IPC roundtrip.
35 void IpcMouseCursorMonitor::OnMouseCursor(
36 scoped_ptr<webrtc::MouseCursor> cursor) {
37 DCHECK(callback_);
38 callback_->OnMouseCursor(cursor.release());
41 } // namespace remoting