Chromium Code Reviews| Index: remoting/host/desktop_session_win.cc |
| diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc |
| index f263e82526fbd3e74f926ab5cfaf33a44677f77b..28cc0293c69cbf01e0de7e91260ae3a842107faa 100644 |
| --- a/remoting/host/desktop_session_win.cc |
| +++ b/remoting/host/desktop_session_win.cc |
| @@ -20,6 +20,7 @@ |
| #include "base/utf_string_conversions.h" |
| #include "base/win/scoped_comptr.h" |
| #include "base/win/scoped_handle.h" |
| +#include "base/win/windows_version.h" |
| #include "ipc/ipc_message_macros.h" |
| #include "ipc/ipc_platform_file.h" |
| #include "net/base/ip_endpoint.h" |
| @@ -516,9 +517,19 @@ void DesktopSessionWin::OnSessionAttached(uint32 session_id) { |
| ReportElapsedTime("attached"); |
| + // Launch elevated on Win8 to be able to inject Alt+Tab. |
| + bool launch_elevated = base::win::GetVersion() >= base::win::VERSION_WIN8; |
| + |
| // Get the name of the executable the desktop process will run. |
|
garykac
2013/05/15 23:24:30
Can you expand this comment to explain why elevate
alexeypa (please no reviews)
2013/05/16 17:50:04
Done.
|
| base::FilePath desktop_binary; |
| - if (!GetInstalledBinaryPath(kDesktopBinaryName, &desktop_binary)) { |
| + bool result; |
| + if (launch_elevated) { |
| + result = GetInstalledBinaryPath(kDesktopBinaryName, &desktop_binary); |
| + } else { |
| + result = GetInstalledBinaryPath(kHostBinaryName, &desktop_binary); |
| + } |
| + |
| + if (!result) { |
| OnPermanentError(); |
| return; |
| } |
| @@ -534,13 +545,17 @@ void DesktopSessionWin::OnSessionAttached(uint32 session_id) { |
| // Create a delegate capable of launching a process in a different session. |
| scoped_ptr<WtsSessionProcessDelegate> delegate( |
| - new WtsSessionProcessDelegate( |
| - caller_task_runner_, io_task_runner_, target.Pass(), session_id, true, |
| - WideToUTF8(kDaemonIpcSecurityDescriptor))); |
| + new WtsSessionProcessDelegate(io_task_runner_, |
| + target.Pass(), |
| + launch_elevated, |
| + WideToUTF8(kDaemonIpcSecurityDescriptor))); |
| + if (!delegate->Initialize(session_id)) { |
| + OnPermanentError(); |
| + return; |
| + } |
| // Create a launcher for the desktop process, using the per-session delegate. |
| - launcher_.reset(new WorkerProcessLauncher( |
| - caller_task_runner_, delegate.Pass(), this)); |
| + launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this)); |
| } |
| void DesktopSessionWin::OnSessionDetached() { |