summaryrefslogtreecommitdiffstats
path: root/remoting/host/local_input_monitor_thread_win.h
blob: 92687b24965b57621e62a51ecc7bf309d0347560 (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
48
49
50
51
52
// Copyright (c) 2012 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_LOCAL_INPUT_MONITOR_THREAD_WIN_H_
#define REMOTING_HOST_LOCAL_INPUT_MONITOR_THREAD_WIN_H_

#include <set>

#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/threading/simple_thread.h"

struct SkIPoint;

namespace remoting {

class MouseMoveObserver;

class LocalInputMonitorThread : public base::SimpleThread {
 public:
  static void AddMouseMoveObserver(MouseMoveObserver* mouse_move_observer);
  static void RemoveMouseMoveObserver(MouseMoveObserver* mouse_move_observer);

 private:
  LocalInputMonitorThread();
  virtual ~LocalInputMonitorThread();

  void AddObserver(MouseMoveObserver* mouse_move_observer);
  bool RemoveObserver(MouseMoveObserver* mouse_move_observer);

  void Stop();

  // Overridden from base::SimpleThread:
  virtual void Run() OVERRIDE;

  void LocalMouseMoved(const SkIPoint& mouse_position);
  static LRESULT WINAPI HandleLowLevelMouseEvent(int code,
                                                 WPARAM event_type,
                                                 LPARAM event_data);

  base::Lock lock_;
  typedef std::set<MouseMoveObserver*> MouseMoveObservers;
  MouseMoveObservers observers_;

  DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorThread);
};

}  // namespace remoting

#endif  // REMOTING_HOST_LOCAL_INPUT_MONITOR_THREAD_WIN_H_