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 "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "ipc/attachment_broker_unprivileged.h" |
20 #include "ipc/ipc_channel_proxy.h" | 21 #include "ipc/ipc_channel_proxy.h" |
21 #include "remoting/base/auto_thread.h" | 22 #include "remoting/base/auto_thread.h" |
22 #include "remoting/base/auto_thread_task_runner.h" | 23 #include "remoting/base/auto_thread_task_runner.h" |
23 #include "remoting/host/chromoting_messages.h" | 24 #include "remoting/host/chromoting_messages.h" |
24 #include "remoting/host/desktop_environment.h" | 25 #include "remoting/host/desktop_environment.h" |
25 #include "remoting/host/desktop_session_agent.h" | 26 #include "remoting/host/desktop_session_agent.h" |
26 | 27 |
27 namespace remoting { | 28 namespace remoting { |
28 | 29 |
29 DesktopProcess::DesktopProcess( | 30 DesktopProcess::DesktopProcess( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 input_task_runner_ = nullptr; | 140 input_task_runner_ = nullptr; |
140 desktop_environment_factory_.reset(); | 141 desktop_environment_factory_.reset(); |
141 return false; | 142 return false; |
142 } | 143 } |
143 | 144 |
144 // Connect to the daemon. | 145 // Connect to the daemon. |
145 daemon_channel_ = | 146 daemon_channel_ = |
146 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT, | 147 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT, |
147 this, io_task_runner.get()); | 148 this, io_task_runner.get()); |
148 | 149 |
| 150 // Attachment broker may be already created in tests. |
| 151 if (!IPC::AttachmentBroker::GetGlobal()) |
| 152 attachment_broker_ = IPC::AttachmentBrokerUnprivileged::CreateBroker(); |
| 153 |
| 154 if (attachment_broker_) { |
| 155 attachment_broker_->DesignateBrokerCommunicationChannel( |
| 156 daemon_channel_.get()); |
| 157 } |
| 158 |
149 // Pass |desktop_pipe| to the daemon. | 159 // Pass |desktop_pipe| to the daemon. |
150 daemon_channel_->Send( | 160 daemon_channel_->Send( |
151 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); | 161 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); |
152 | 162 |
153 return true; | 163 return true; |
154 } | 164 } |
155 | 165 |
156 void DesktopProcess::OnCrash(const std::string& function_name, | 166 void DesktopProcess::OnCrash(const std::string& function_name, |
157 const std::string& file_name, | 167 const std::string& file_name, |
158 const int& line_number) { | 168 const int& line_number) { |
159 char message[1024]; | 169 char message[1024]; |
160 base::snprintf(message, sizeof(message), | 170 base::snprintf(message, sizeof(message), |
161 "Requested by %s at %s, line %d.", | 171 "Requested by %s at %s, line %d.", |
162 function_name.c_str(), file_name.c_str(), line_number); | 172 function_name.c_str(), file_name.c_str(), line_number); |
163 base::debug::Alias(message); | 173 base::debug::Alias(message); |
164 | 174 |
165 // The daemon requested us to crash the process. | 175 // The daemon requested us to crash the process. |
166 CHECK(false) << message; | 176 CHECK(false) << message; |
167 } | 177 } |
168 | 178 |
169 } // namespace remoting | 179 } // namespace remoting |
OLD | NEW |