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/win/session_input_injector.h" | 5 #include "remoting/host/win/session_input_injector.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 namespace remoting { | 40 namespace remoting { |
41 | 41 |
42 using protocol::ClipboardEvent; | 42 using protocol::ClipboardEvent; |
43 using protocol::KeyEvent; | 43 using protocol::KeyEvent; |
44 using protocol::MouseEvent; | 44 using protocol::MouseEvent; |
45 using protocol::TextEvent; | 45 using protocol::TextEvent; |
46 using protocol::TouchEvent; | |
46 | 47 |
47 class SessionInputInjectorWin::Core | 48 class SessionInputInjectorWin::Core |
48 : public base::RefCountedThreadSafe<SessionInputInjectorWin::Core>, | 49 : public base::RefCountedThreadSafe<SessionInputInjectorWin::Core>, |
49 public InputInjector { | 50 public InputInjector { |
50 public: | 51 public: |
51 Core( | 52 Core( |
52 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 53 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
53 scoped_ptr<InputInjector> nested_executor, | 54 scoped_ptr<InputInjector> nested_executor, |
54 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, | 55 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner, |
55 const base::Closure& inject_sas); | 56 const base::Closure& inject_sas); |
56 | 57 |
57 // InputInjector implementation. | 58 // InputInjector implementation. |
58 virtual void Start( | 59 virtual void Start( |
59 scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 60 scoped_ptr<ClipboardStub> client_clipboard) override; |
60 | 61 |
61 // protocol::ClipboardStub implementation. | 62 // protocol::ClipboardStub implementation. |
62 virtual void InjectClipboardEvent( | 63 virtual void InjectClipboardEvent( |
63 const protocol::ClipboardEvent& event) override; | 64 const ClipboardEvent& event) override; |
64 | 65 |
65 // protocol::InputStub implementation. | 66 // protocol::InputStub implementation. |
66 virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; | 67 virtual void InjectKeyEvent(const KeyEvent& event) override; |
67 virtual void InjectTextEvent(const protocol::TextEvent& event) override; | 68 virtual void InjectTextEvent(const TextEvent& event) override; |
68 virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; | 69 virtual void InjectMouseEvent(const MouseEvent& event) override; |
70 virtual void InjectTouchEvent(const TouchEvent& event) override; | |
69 | 71 |
70 private: | 72 private: |
71 friend class base::RefCountedThreadSafe<Core>; | 73 friend class base::RefCountedThreadSafe<Core>; |
72 virtual ~Core(); | 74 virtual ~Core(); |
73 | 75 |
74 // Switches to the desktop receiving a user input if different from | 76 // Switches to the desktop receiving a user input if different from |
75 // the current one. | 77 // the current one. |
76 void SwitchToInputDesktop(); | 78 void SwitchToInputDesktop(); |
77 | 79 |
78 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 if (!input_task_runner_->BelongsToCurrentThread()) { | 184 if (!input_task_runner_->BelongsToCurrentThread()) { |
183 input_task_runner_->PostTask( | 185 input_task_runner_->PostTask( |
184 FROM_HERE, base::Bind(&Core::InjectMouseEvent, this, event)); | 186 FROM_HERE, base::Bind(&Core::InjectMouseEvent, this, event)); |
185 return; | 187 return; |
186 } | 188 } |
187 | 189 |
188 SwitchToInputDesktop(); | 190 SwitchToInputDesktop(); |
189 nested_executor_->InjectMouseEvent(event); | 191 nested_executor_->InjectMouseEvent(event); |
190 } | 192 } |
191 | 193 |
194 void SessionInputInjectorWin::Core::InjectTouchEvent(const TouchEvent& event) { | |
195 NOTIMPLEMENTED(); | |
196 } | |
197 | |
192 SessionInputInjectorWin::Core::~Core() { | 198 SessionInputInjectorWin::Core::~Core() { |
193 } | 199 } |
194 | 200 |
195 void SessionInputInjectorWin::Core::SwitchToInputDesktop() { | 201 void SessionInputInjectorWin::Core::SwitchToInputDesktop() { |
196 // Switch to the desktop receiving user input if different from the current | 202 // Switch to the desktop receiving user input if different from the current |
197 // one. | 203 // one. |
198 scoped_ptr<webrtc::Desktop> input_desktop( | 204 scoped_ptr<webrtc::Desktop> input_desktop( |
199 webrtc::Desktop::GetInputDesktop()); | 205 webrtc::Desktop::GetInputDesktop()); |
200 if (input_desktop.get() != nullptr && !desktop_.IsSame(*input_desktop)) { | 206 if (input_desktop.get() != nullptr && !desktop_.IsSame(*input_desktop)) { |
201 // If SetThreadDesktop() fails, the thread is still assigned a desktop. | 207 // If SetThreadDesktop() fails, the thread is still assigned a desktop. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 void SessionInputInjectorWin::InjectTextEvent( | 239 void SessionInputInjectorWin::InjectTextEvent( |
234 const protocol::TextEvent& event) { | 240 const protocol::TextEvent& event) { |
235 core_->InjectTextEvent(event); | 241 core_->InjectTextEvent(event); |
236 } | 242 } |
237 | 243 |
238 void SessionInputInjectorWin::InjectMouseEvent( | 244 void SessionInputInjectorWin::InjectMouseEvent( |
239 const protocol::MouseEvent& event) { | 245 const protocol::MouseEvent& event) { |
240 core_->InjectMouseEvent(event); | 246 core_->InjectMouseEvent(event); |
241 } | 247 } |
242 | 248 |
249 void SessionInputInjectorWin::InjectTouchEvent( | |
250 const protocol::TouchEvent& event) { | |
251 NOTIMPLEMENTED(); | |
Wez
2015/01/21 03:08:37
I think you meant to punt the event on to the Core
Rintaro Kuroiwa
2015/01/28 01:12:29
Done.
| |
252 } | |
253 | |
243 } // namespace remoting | 254 } // namespace remoting |
OLD | NEW |