blob: 1785a96877df8aef472698f41625ad3527ce5c31 (
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
53
54
55
|
// 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.
#include "remoting/host/local_input_monitor.h"
#include "remoting/host/local_input_monitor_thread_linux.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
namespace remoting {
namespace {
class LocalInputMonitorLinux : public LocalInputMonitor {
public:
LocalInputMonitorLinux();
~LocalInputMonitorLinux();
virtual void Start(ChromotingHost* host) OVERRIDE;
virtual void Stop() OVERRIDE;
private:
LocalInputMonitorThread* thread_;
};
LocalInputMonitorLinux::LocalInputMonitorLinux()
: thread_(NULL) {
}
LocalInputMonitorLinux::~LocalInputMonitorLinux() {
CHECK(!thread_);
}
void LocalInputMonitorLinux::Start(ChromotingHost* host) {
CHECK(!thread_);
thread_ = new LocalInputMonitorThread(host);
thread_->Start();
}
void LocalInputMonitorLinux::Stop() {
CHECK(thread_);
thread_->Stop();
thread_->Join();
delete thread_;
thread_ = 0;
}
} // namespace
scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() {
return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorLinux());
}
} // namespace remoting
|