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_event_executor.h" | 5 #include "remoting/host/win/session_event_executor.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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
16 #include "remoting/capturer/win/desktop.h" | 16 #include "media/video/capture/screen/win/desktop.h" |
17 #include "remoting/capturer/win/scoped_thread_desktop.h" | 17 #include "media/video/capture/screen/win/scoped_thread_desktop.h" |
18 #include "remoting/host/sas_injector.h" | 18 #include "remoting/host/sas_injector.h" |
19 #include "remoting/proto/event.pb.h" | 19 #include "remoting/proto/event.pb.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const uint32 kUsbLeftControl = 0x0700e0; | 23 const uint32 kUsbLeftControl = 0x0700e0; |
24 const uint32 kUsbRightControl = 0x0700e4; | 24 const uint32 kUsbRightControl = 0x0700e4; |
25 const uint32 kUsbLeftAlt = 0x0700e2; | 25 const uint32 kUsbLeftAlt = 0x0700e2; |
26 const uint32 kUsbRightAlt = 0x0700e6; | 26 const uint32 kUsbRightAlt = 0x0700e6; |
27 const uint32 kUsbDelete = 0x07004c; | 27 const uint32 kUsbDelete = 0x07004c; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // the current one. | 73 // the current one. |
74 void SwitchToInputDesktop(); | 74 void SwitchToInputDesktop(); |
75 | 75 |
76 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 76 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
77 | 77 |
78 // Pointer to the next event executor. | 78 // Pointer to the next event executor. |
79 scoped_ptr<EventExecutor> nested_executor_; | 79 scoped_ptr<EventExecutor> nested_executor_; |
80 | 80 |
81 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner_; | 81 scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner_; |
82 | 82 |
83 ScopedThreadDesktop desktop_; | 83 media::ScopedThreadDesktop desktop_; |
84 | 84 |
85 // Used to inject Secure Attention Sequence on Vista+. | 85 // Used to inject Secure Attention Sequence on Vista+. |
86 base::Closure inject_sas_; | 86 base::Closure inject_sas_; |
87 | 87 |
88 // Used to inject Secure Attention Sequence on XP. | 88 // Used to inject Secure Attention Sequence on XP. |
89 scoped_ptr<SasInjector> sas_injector_; | 89 scoped_ptr<SasInjector> sas_injector_; |
90 | 90 |
91 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. | 91 // Keys currently pressed by the client, used to detect Ctrl-Alt-Del. |
92 std::set<uint32> pressed_keys_; | 92 std::set<uint32> pressed_keys_; |
93 | 93 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 SwitchToInputDesktop(); | 175 SwitchToInputDesktop(); |
176 nested_executor_->InjectMouseEvent(event); | 176 nested_executor_->InjectMouseEvent(event); |
177 } | 177 } |
178 | 178 |
179 SessionEventExecutorWin::Core::~Core() { | 179 SessionEventExecutorWin::Core::~Core() { |
180 } | 180 } |
181 | 181 |
182 void SessionEventExecutorWin::Core::SwitchToInputDesktop() { | 182 void SessionEventExecutorWin::Core::SwitchToInputDesktop() { |
183 // Switch to the desktop receiving user input if different from the current | 183 // Switch to the desktop receiving user input if different from the current |
184 // one. | 184 // one. |
185 scoped_ptr<Desktop> input_desktop = Desktop::GetInputDesktop(); | 185 scoped_ptr<media::Desktop> input_desktop = media::Desktop::GetInputDesktop(); |
186 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) { | 186 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) { |
187 // If SetThreadDesktop() fails, the thread is still assigned a desktop. | 187 // If SetThreadDesktop() fails, the thread is still assigned a desktop. |
188 // So we can continue capture screen bits, just from a diffected desktop. | 188 // So we can continue capture screen bits, just from a diffected desktop. |
189 desktop_.SetThreadDesktop(input_desktop.Pass()); | 189 desktop_.SetThreadDesktop(input_desktop.Pass()); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 SessionEventExecutorWin::SessionEventExecutorWin( | 193 SessionEventExecutorWin::SessionEventExecutorWin( |
194 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 194 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
195 scoped_ptr<EventExecutor> nested_executor, | 195 scoped_ptr<EventExecutor> nested_executor, |
(...skipping 19 matching lines...) Expand all Loading... |
215 void SessionEventExecutorWin::InjectKeyEvent(const protocol::KeyEvent& event) { | 215 void SessionEventExecutorWin::InjectKeyEvent(const protocol::KeyEvent& event) { |
216 core_->InjectKeyEvent(event); | 216 core_->InjectKeyEvent(event); |
217 } | 217 } |
218 | 218 |
219 void SessionEventExecutorWin::InjectMouseEvent( | 219 void SessionEventExecutorWin::InjectMouseEvent( |
220 const protocol::MouseEvent& event) { | 220 const protocol::MouseEvent& event) { |
221 core_->InjectMouseEvent(event); | 221 core_->InjectMouseEvent(event); |
222 } | 222 } |
223 | 223 |
224 } // namespace remoting | 224 } // namespace remoting |
OLD | NEW |