summaryrefslogtreecommitdiffstats
path: root/remoting/host/mouse_shape_pump.h
blob: cf6f370eda4352c7e00ffe80df6188f948f9b07a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_HOST_MOUSE_SHAPE_PUMP_H_
#define REMOTING_HOST_MOUSE_SHAPE_PUMP_H_

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"

namespace remoting {

namespace protocol {
class CursorShapeStub;
}  // namespace

// MouseShapePump is responsible for capturing mouse shape using
// MouseCursorMonitor and sending it to a CursorShapeStub.
class MouseShapePump : public webrtc::MouseCursorMonitor::Callback {
 public:
  MouseShapePump(scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
                 protocol::CursorShapeStub* cursor_shape_stub);
  ~MouseShapePump() override;

 private:
  void Capture();

  // webrtc::MouseCursorMonitor::Callback implementation.
  void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override;
  void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state,
                             const webrtc::DesktopVector& position) override;

  base::ThreadChecker thread_checker_;
  scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
  protocol::CursorShapeStub* cursor_shape_stub_;

  base::Timer capture_timer_;

  DISALLOW_COPY_AND_ASSIGN(MouseShapePump);
};

}  // namespace remoting

#endif  // REMOTING_HOST_MOUSE_SHAPE_PUMP_H_