OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "remoting/host/chromoting_host.h" | 9 #include "remoting/host/chromoting_host.h" |
10 #include "remoting/host/local_input_monitor_thread_win.h" | 10 #include "remoting/host/local_input_monitor_thread_win.h" |
11 | 11 |
| 12 namespace remoting { |
| 13 |
12 namespace { | 14 namespace { |
13 | 15 |
14 class LocalInputMonitorWin : public remoting::LocalInputMonitor { | 16 class LocalInputMonitorWin : public LocalInputMonitor { |
15 public: | 17 public: |
16 LocalInputMonitorWin(); | 18 LocalInputMonitorWin(); |
17 ~LocalInputMonitorWin(); | 19 ~LocalInputMonitorWin(); |
18 | 20 |
19 virtual void Start(remoting::ChromotingHost* host) OVERRIDE; | 21 virtual void Start(ChromotingHost* host) OVERRIDE; |
20 virtual void Stop() OVERRIDE; | 22 virtual void Stop() OVERRIDE; |
21 | 23 |
22 private: | 24 private: |
23 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorWin); | 25 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorWin); |
24 | 26 |
25 remoting::ChromotingHost* chromoting_host_; | 27 ChromotingHost* chromoting_host_; |
26 }; | 28 }; |
27 | 29 |
28 } // namespace | |
29 | |
30 | |
31 LocalInputMonitorWin::LocalInputMonitorWin() : chromoting_host_(NULL) { | 30 LocalInputMonitorWin::LocalInputMonitorWin() : chromoting_host_(NULL) { |
32 } | 31 } |
33 | 32 |
34 LocalInputMonitorWin::~LocalInputMonitorWin() { | 33 LocalInputMonitorWin::~LocalInputMonitorWin() { |
35 DCHECK(chromoting_host_ == NULL); | 34 DCHECK(chromoting_host_ == NULL); |
36 } | 35 } |
37 | 36 |
38 void LocalInputMonitorWin::Start(remoting::ChromotingHost* host) { | 37 void LocalInputMonitorWin::Start(ChromotingHost* host) { |
39 DCHECK(chromoting_host_ == NULL); | 38 DCHECK(chromoting_host_ == NULL); |
40 chromoting_host_ = host; | 39 chromoting_host_ = host; |
41 remoting::LocalInputMonitorThread::AddHostToInputMonitor(chromoting_host_); | 40 LocalInputMonitorThread::AddHostToInputMonitor(chromoting_host_); |
42 } | 41 } |
43 | 42 |
44 void LocalInputMonitorWin::Stop() { | 43 void LocalInputMonitorWin::Stop() { |
45 DCHECK(chromoting_host_ != NULL); | 44 DCHECK(chromoting_host_ != NULL); |
46 remoting::LocalInputMonitorThread::RemoveHostFromInputMonitor( | 45 LocalInputMonitorThread::RemoveHostFromInputMonitor(chromoting_host_); |
47 chromoting_host_); | |
48 chromoting_host_ = NULL; | 46 chromoting_host_ = NULL; |
49 } | 47 } |
50 | 48 |
51 remoting::LocalInputMonitor* remoting::LocalInputMonitor::Create() { | 49 } // namespace |
52 return new LocalInputMonitorWin; | 50 |
| 51 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() { |
| 52 return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorWin()); |
53 } | 53 } |
| 54 |
| 55 } // namespace remoting |
OLD | NEW |