| 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 <sys/select.h> | 7 #include <sys/select.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #define XK_MISCELLANY | 9 #define XK_MISCELLANY |
| 10 #include <X11/keysymdef.h> | 10 #include <X11/keysymdef.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 class LocalInputMonitorLinux : public base::NonThreadSafe, | 35 class LocalInputMonitorLinux : public base::NonThreadSafe, |
| 36 public LocalInputMonitor { | 36 public LocalInputMonitor { |
| 37 public: | 37 public: |
| 38 LocalInputMonitorLinux( | 38 LocalInputMonitorLinux( |
| 39 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 39 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 41 base::WeakPtr<ClientSessionControl> client_session_control); | 41 base::WeakPtr<ClientSessionControl> client_session_control); |
| 42 virtual ~LocalInputMonitorLinux(); | 42 ~LocalInputMonitorLinux() override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 // The actual implementation resides in LocalInputMonitorLinux::Core class. | 45 // The actual implementation resides in LocalInputMonitorLinux::Core class. |
| 46 class Core | 46 class Core |
| 47 : public base::RefCountedThreadSafe<Core>, | 47 : public base::RefCountedThreadSafe<Core>, |
| 48 public base::MessagePumpLibevent::Watcher { | 48 public base::MessagePumpLibevent::Watcher { |
| 49 public: | 49 public: |
| 50 Core(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 50 Core(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 51 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 51 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 52 base::WeakPtr<ClientSessionControl> client_session_control); | 52 base::WeakPtr<ClientSessionControl> client_session_control); |
| 53 | 53 |
| 54 void Start(); | 54 void Start(); |
| 55 void Stop(); | 55 void Stop(); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 friend class base::RefCountedThreadSafe<Core>; | 58 friend class base::RefCountedThreadSafe<Core>; |
| 59 virtual ~Core(); | 59 ~Core() override; |
| 60 | 60 |
| 61 void StartOnInputThread(); | 61 void StartOnInputThread(); |
| 62 void StopOnInputThread(); | 62 void StopOnInputThread(); |
| 63 | 63 |
| 64 // base::MessagePumpLibevent::Watcher interface. | 64 // base::MessagePumpLibevent::Watcher interface. |
| 65 virtual void OnFileCanReadWithoutBlocking(int fd) override; | 65 void OnFileCanReadWithoutBlocking(int fd) override; |
| 66 virtual void OnFileCanWriteWithoutBlocking(int fd) override; | 66 void OnFileCanWriteWithoutBlocking(int fd) override; |
| 67 | 67 |
| 68 // Processes key and mouse events. | 68 // Processes key and mouse events. |
| 69 void ProcessXEvent(xEvent* event); | 69 void ProcessXEvent(xEvent* event); |
| 70 | 70 |
| 71 static void ProcessReply(XPointer self, XRecordInterceptData* data); | 71 static void ProcessReply(XPointer self, XRecordInterceptData* data); |
| 72 | 72 |
| 73 // Task runner on which public methods of this class must be called. | 73 // Task runner on which public methods of this class must be called. |
| 74 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 74 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 75 | 75 |
| 76 // Task runner on which X Window events are received. | 76 // Task runner on which X Window events are received. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( | 320 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create( |
| 321 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 321 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 322 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 322 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 323 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 323 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 324 base::WeakPtr<ClientSessionControl> client_session_control) { | 324 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 325 return make_scoped_ptr(new LocalInputMonitorLinux( | 325 return make_scoped_ptr(new LocalInputMonitorLinux( |
| 326 caller_task_runner, input_task_runner, client_session_control)); | 326 caller_task_runner, input_task_runner, client_session_control)); |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace remoting | 329 } // namespace remoting |
| OLD | NEW |