Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: remoting/host/session_event_executor_win.cc

Issue 10832068: Moving Windows-only files: remoting/host -> remoting/host/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/session_event_executor_win.h ('k') | remoting/host/verify_config_window_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/session_event_executor_win.h" 5 #include "remoting/host/session_event_executor_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #include "ipc/ipc_channel.h" 14 #include "ipc/ipc_channel.h"
15 #include "ipc/ipc_channel_proxy.h" 15 #include "ipc/ipc_channel_proxy.h"
16 #include "remoting/host/chromoting_messages.h"
17 #include "remoting/host/win/desktop.h"
18 #include "remoting/host/win/scoped_thread_desktop.h"
16 #include "remoting/proto/event.pb.h" 19 #include "remoting/proto/event.pb.h"
17 #include "remoting/host/chromoting_messages.h"
18 #include "remoting/host/desktop_win.h"
19 #include "remoting/host/scoped_thread_desktop_win.h"
20 20
21 namespace { 21 namespace {
22 22
23 // The command line switch specifying the name of the Chromoting IPC channel. 23 // The command line switch specifying the name of the Chromoting IPC channel.
24 const char kProcessChannelId[] = "chromoting-ipc"; 24 const char kProcessChannelId[] = "chromoting-ipc";
25 25
26 const uint32 kUsbLeftControl = 0x0700e0; 26 const uint32 kUsbLeftControl = 0x0700e0;
27 const uint32 kUsbRightControl = 0x0700e4; 27 const uint32 kUsbRightControl = 0x0700e4;
28 const uint32 kUsbLeftAlt = 0x0700e2; 28 const uint32 kUsbLeftAlt = 0x0700e2;
29 const uint32 kUsbRightAlt = 0x0700e6; 29 const uint32 kUsbRightAlt = 0x0700e6;
30 const uint32 kUsbDelete = 0x07004c; 30 const uint32 kUsbDelete = 0x07004c;
31 31
32 bool CheckCtrlAndAltArePressed(const std::set<uint32>& pressed_keys) { 32 bool CheckCtrlAndAltArePressed(const std::set<uint32>& pressed_keys) {
33 size_t ctrl_keys = pressed_keys.count(kUsbLeftControl) + 33 size_t ctrl_keys = pressed_keys.count(kUsbLeftControl) +
34 pressed_keys.count(kUsbRightControl); 34 pressed_keys.count(kUsbRightControl);
35 size_t alt_keys = pressed_keys.count(kUsbLeftAlt) + 35 size_t alt_keys = pressed_keys.count(kUsbLeftAlt) +
36 pressed_keys.count(kUsbRightAlt); 36 pressed_keys.count(kUsbRightAlt);
37 return ctrl_keys != 0 && alt_keys != 0 && 37 return ctrl_keys != 0 && alt_keys != 0 &&
38 (ctrl_keys + alt_keys == pressed_keys.size()); 38 (ctrl_keys + alt_keys == pressed_keys.size());
39 } 39 }
40 40
41 // Emulates Secure Attention Sequence (Ctrl+Alt+Del) by switching to 41 // Emulates Secure Attention Sequence (Ctrl+Alt+Del) by switching to
42 // the Winlogon desktop and injecting Ctrl+Alt+Del as a hot key. 42 // the Winlogon desktop and injecting Ctrl+Alt+Del as a hot key.
43 // N.B. Windows XP/W2K3 only. 43 // N.B. Windows XP/W2K3 only.
44 void EmulateSecureAttentionSequence() { 44 void EmulateSecureAttentionSequence() {
45 const wchar_t kWinlogonDesktopName[] = L"Winlogon"; 45 const wchar_t kWinlogonDesktopName[] = L"Winlogon";
46 const wchar_t kSasWindowClassName[] = L"SAS window class"; 46 const wchar_t kSasWindowClassName[] = L"SAS window class";
47 const wchar_t kSasWindowTitle[] = L"SAS window"; 47 const wchar_t kSasWindowTitle[] = L"SAS window";
48 48
49 scoped_ptr<remoting::DesktopWin> winlogon_desktop( 49 scoped_ptr<remoting::Desktop> winlogon_desktop(
50 remoting::DesktopWin::GetDesktop(kWinlogonDesktopName)); 50 remoting::Desktop::GetDesktop(kWinlogonDesktopName));
51 if (!winlogon_desktop.get()) 51 if (!winlogon_desktop.get())
52 return; 52 return;
53 53
54 remoting::ScopedThreadDesktopWin desktop; 54 remoting::ScopedThreadDesktop desktop;
55 if (!desktop.SetThreadDesktop(winlogon_desktop.Pass())) 55 if (!desktop.SetThreadDesktop(winlogon_desktop.Pass()))
56 return; 56 return;
57 57
58 HWND window = FindWindow(kSasWindowClassName, kSasWindowTitle); 58 HWND window = FindWindow(kSasWindowClassName, kSasWindowTitle);
59 if (!window) 59 if (!window)
60 return; 60 return;
61 61
62 PostMessage(window, 62 PostMessage(window,
63 WM_HOTKEY, 63 WM_HOTKEY,
64 0, 64 0,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 nested_executor_->InjectMouseEvent(event); 188 nested_executor_->InjectMouseEvent(event);
189 } 189 }
190 190
191 bool SessionEventExecutorWin::OnMessageReceived(const IPC::Message& message) { 191 bool SessionEventExecutorWin::OnMessageReceived(const IPC::Message& message) {
192 return false; 192 return false;
193 } 193 }
194 194
195 void SessionEventExecutorWin::SwitchToInputDesktop() { 195 void SessionEventExecutorWin::SwitchToInputDesktop() {
196 // Switch to the desktop receiving user input if different from the current 196 // Switch to the desktop receiving user input if different from the current
197 // one. 197 // one.
198 scoped_ptr<DesktopWin> input_desktop = DesktopWin::GetInputDesktop(); 198 scoped_ptr<Desktop> input_desktop = Desktop::GetInputDesktop();
199 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) { 199 if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
200 // If SetThreadDesktop() fails, the thread is still assigned a desktop. 200 // If SetThreadDesktop() fails, the thread is still assigned a desktop.
201 // So we can continue capture screen bits, just from a diffected desktop. 201 // So we can continue capture screen bits, just from a diffected desktop.
202 desktop_.SetThreadDesktop(input_desktop.Pass()); 202 desktop_.SetThreadDesktop(input_desktop.Pass());
203 } 203 }
204 } 204 }
205 205
206 } // namespace remoting 206 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/session_event_executor_win.h ('k') | remoting/host/verify_config_window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698