Chromium Code Reviews| 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 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
| 6 // running within user sessions. | 6 // running within user sessions. |
| 7 | 7 |
| 8 #include "remoting/host/desktop_process.h" | 8 #include "remoting/host/desktop_process.h" |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/win/windows_version.h" | |
|
Jamie
2016/04/29 00:41:42
Does this also need an ifdef?
joedow
2016/04/29 16:13:09
Done.
| |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "ipc/attachment_broker_unprivileged.h" | 21 #include "ipc/attachment_broker_unprivileged.h" |
| 21 #include "ipc/ipc_channel_proxy.h" | 22 #include "ipc/ipc_channel_proxy.h" |
| 22 #include "remoting/base/auto_thread.h" | 23 #include "remoting/base/auto_thread.h" |
| 23 #include "remoting/base/auto_thread_task_runner.h" | 24 #include "remoting/base/auto_thread_task_runner.h" |
| 24 #include "remoting/host/chromoting_messages.h" | 25 #include "remoting/host/chromoting_messages.h" |
| 25 #include "remoting/host/desktop_environment.h" | 26 #include "remoting/host/desktop_environment.h" |
| 26 #include "remoting/host/desktop_session_agent.h" | 27 #include "remoting/host/desktop_session_agent.h" |
| 27 | 28 |
| 28 namespace remoting { | 29 namespace remoting { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 54 | 55 |
| 55 OnChannelError(); | 56 OnChannelError(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void DesktopProcess::InjectSas() { | 59 void DesktopProcess::InjectSas() { |
| 59 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 60 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 60 | 61 |
| 61 daemon_channel_->Send(new ChromotingDesktopDaemonMsg_InjectSas()); | 62 daemon_channel_->Send(new ChromotingDesktopDaemonMsg_InjectSas()); |
| 62 } | 63 } |
| 63 | 64 |
| 65 void DesktopProcess::LockWorkStation() { | |
| 66 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | |
| 67 #if defined(OS_WIN) | |
| 68 if (base::win::OSInfo::GetInstance()->version_type() == | |
| 69 base::win::VersionType::SUITE_HOME) { | |
| 70 return; | |
| 71 } | |
| 72 | |
| 73 if (!::LockWorkStation()) { | |
| 74 LOG(ERROR) << "LockWorkStation() failed: " << ::GetLastError(); | |
| 75 } | |
| 76 #else | |
| 77 NOTIMPLEMENTED(); | |
|
Jamie
2016/04/29 00:41:42
Maybe NOTREACHED would be more appropriate here?
joedow
2016/04/29 16:13:09
Done.
| |
| 78 #endif // defined(OS_WIN) | |
| 79 } | |
|
Jamie
2016/04/28 22:00:11
I think this needs to factored out more cleanly in
joedow
2016/04/29 16:13:09
Acknowledged.
| |
| 80 | |
| 64 bool DesktopProcess::OnMessageReceived(const IPC::Message& message) { | 81 bool DesktopProcess::OnMessageReceived(const IPC::Message& message) { |
| 65 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 82 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 66 | 83 |
| 67 bool handled = true; | 84 bool handled = true; |
| 68 IPC_BEGIN_MESSAGE_MAP(DesktopProcess, message) | 85 IPC_BEGIN_MESSAGE_MAP(DesktopProcess, message) |
| 69 IPC_MESSAGE_HANDLER(ChromotingDaemonMsg_Crash, OnCrash) | 86 IPC_MESSAGE_HANDLER(ChromotingDaemonMsg_Crash, OnCrash) |
| 70 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
| 71 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
| 72 | 89 |
| 73 CHECK(handled) << "Received unexpected IPC type: " << message.type(); | 90 CHECK(handled) << "Received unexpected IPC type: " << message.type(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 base::snprintf(message, sizeof(message), | 178 base::snprintf(message, sizeof(message), |
| 162 "Requested by %s at %s, line %d.", | 179 "Requested by %s at %s, line %d.", |
| 163 function_name.c_str(), file_name.c_str(), line_number); | 180 function_name.c_str(), file_name.c_str(), line_number); |
| 164 base::debug::Alias(message); | 181 base::debug::Alias(message); |
| 165 | 182 |
| 166 // The daemon requested us to crash the process. | 183 // The daemon requested us to crash the process. |
| 167 CHECK(false) << message; | 184 CHECK(false) << message; |
| 168 } | 185 } |
| 169 | 186 |
| 170 } // namespace remoting | 187 } // namespace remoting |
| OLD | NEW |