| 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 | 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 { | 12 namespace remoting { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class LocalInputMonitorWin : public LocalInputMonitor { | 16 class LocalInputMonitorWin : public LocalInputMonitor { |
| 17 public: | 17 public: |
| 18 LocalInputMonitorWin(); | 18 LocalInputMonitorWin(); |
| 19 ~LocalInputMonitorWin(); | 19 ~LocalInputMonitorWin(); |
| 20 | 20 |
| 21 virtual void Start(ChromotingHost* host) OVERRIDE; | 21 virtual void Start(MouseMoveObserver* mouse_move_observer, |
| 22 const base::Closure& disconnect_callback) OVERRIDE; |
| 22 virtual void Stop() OVERRIDE; | 23 virtual void Stop() OVERRIDE; |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorWin); | 26 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorWin); |
| 26 | 27 |
| 27 ChromotingHost* chromoting_host_; | 28 MouseMoveObserver* mouse_move_observer_; |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 LocalInputMonitorWin::LocalInputMonitorWin() : chromoting_host_(NULL) { | 31 LocalInputMonitorWin::LocalInputMonitorWin() |
| 32 : mouse_move_observer_(NULL) { |
| 31 } | 33 } |
| 32 | 34 |
| 33 LocalInputMonitorWin::~LocalInputMonitorWin() { | 35 LocalInputMonitorWin::~LocalInputMonitorWin() { |
| 34 DCHECK(chromoting_host_ == NULL); | 36 DCHECK(!mouse_move_observer_); |
| 35 } | 37 } |
| 36 | 38 |
| 37 void LocalInputMonitorWin::Start(ChromotingHost* host) { | 39 void LocalInputMonitorWin::Start(MouseMoveObserver* mouse_move_observer, |
| 38 DCHECK(chromoting_host_ == NULL); | 40 const base::Closure& disconnect_callback) { |
| 39 chromoting_host_ = host; | 41 DCHECK(!mouse_move_observer_); |
| 40 LocalInputMonitorThread::AddHostToInputMonitor(chromoting_host_); | 42 mouse_move_observer_ = mouse_move_observer; |
| 43 LocalInputMonitorThread::AddMouseMoveObserver(mouse_move_observer_); |
| 41 } | 44 } |
| 42 | 45 |
| 43 void LocalInputMonitorWin::Stop() { | 46 void LocalInputMonitorWin::Stop() { |
| 44 DCHECK(chromoting_host_ != NULL); | 47 DCHECK(mouse_move_observer_); |
| 45 LocalInputMonitorThread::RemoveHostFromInputMonitor(chromoting_host_); | 48 LocalInputMonitorThread::RemoveMouseMoveObserver(mouse_move_observer_); |
| 46 chromoting_host_ = NULL; | 49 mouse_move_observer_ = NULL; |
| 47 } | 50 } |
| 48 | 51 |
| 49 } // namespace | 52 } // namespace |
| 50 | 53 |
| 51 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() { | 54 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() { |
| 52 return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorWin()); | 55 return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorWin()); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace remoting | 58 } // namespace remoting |
| OLD | NEW |