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 #include "remoting/host/local_input_monitor_thread_linux.h" | 6 #include "remoting/host/local_input_monitor_thread_linux.h" |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
| 11 namespace remoting { |
| 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 class LocalInputMonitorLinux : public remoting::LocalInputMonitor { | 15 class LocalInputMonitorLinux : public LocalInputMonitor { |
14 public: | 16 public: |
15 LocalInputMonitorLinux(); | 17 LocalInputMonitorLinux(); |
16 ~LocalInputMonitorLinux(); | 18 ~LocalInputMonitorLinux(); |
17 | 19 |
18 virtual void Start(remoting::ChromotingHost* host) OVERRIDE; | 20 virtual void Start(ChromotingHost* host) OVERRIDE; |
19 virtual void Stop() OVERRIDE; | 21 virtual void Stop() OVERRIDE; |
20 | 22 |
21 private: | 23 private: |
22 remoting::LocalInputMonitorThread* thread_; | 24 LocalInputMonitorThread* thread_; |
23 }; | 25 }; |
24 | 26 |
25 } // namespace | |
26 | |
27 | |
28 LocalInputMonitorLinux::LocalInputMonitorLinux() | 27 LocalInputMonitorLinux::LocalInputMonitorLinux() |
29 : thread_(NULL) { | 28 : thread_(NULL) { |
30 } | 29 } |
31 | 30 |
32 LocalInputMonitorLinux::~LocalInputMonitorLinux() { | 31 LocalInputMonitorLinux::~LocalInputMonitorLinux() { |
33 CHECK(!thread_); | 32 CHECK(!thread_); |
34 } | 33 } |
35 | 34 |
36 void LocalInputMonitorLinux::Start(remoting::ChromotingHost* host) { | 35 void LocalInputMonitorLinux::Start(ChromotingHost* host) { |
37 CHECK(!thread_); | 36 CHECK(!thread_); |
38 thread_ = new remoting::LocalInputMonitorThread(host); | 37 thread_ = new LocalInputMonitorThread(host); |
39 thread_->Start(); | 38 thread_->Start(); |
40 } | 39 } |
41 | 40 |
42 void LocalInputMonitorLinux::Stop() { | 41 void LocalInputMonitorLinux::Stop() { |
43 CHECK(thread_); | 42 CHECK(thread_); |
44 thread_->Stop(); | 43 thread_->Stop(); |
45 thread_->Join(); | 44 thread_->Join(); |
46 delete thread_; | 45 delete thread_; |
47 thread_ = 0; | 46 thread_ = 0; |
48 } | 47 } |
49 | 48 |
50 remoting::LocalInputMonitor* remoting::LocalInputMonitor::Create() { | 49 } // namespace |
51 return new LocalInputMonitorLinux; | 50 |
| 51 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() { |
| 52 return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorLinux()); |
52 } | 53 } |
| 54 |
| 55 } // namespace remoting |
OLD | NEW |