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