| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ipc_util.h" | 5 #include "remoting/host/ipc_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Create the server end of the channel. | 53 // Create the server end of the channel. |
| 54 ScopedHandle pipe; | 54 ScopedHandle pipe; |
| 55 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { | 55 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Wrap the pipe into an IPC channel. | 59 // Wrap the pipe into an IPC channel. |
| 60 std::unique_ptr<IPC::ChannelProxy> server( | 60 std::unique_ptr<IPC::ChannelProxy> server( |
| 61 new IPC::ChannelProxy(listener, io_task_runner)); | 61 new IPC::ChannelProxy(listener, io_task_runner)); |
| 62 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 62 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); |
| 63 server.get(), io_task_runner); | 63 DCHECK(broker) << "No AttachmentBroker registered."; |
| 64 if (broker->IsPrivilegedBroker()) { |
| 65 broker->RegisterCommunicationChannel(server.get(), io_task_runner); |
| 66 } |
| 64 server->Init(IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, | 67 server->Init(IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, |
| 65 true); | 68 /*create_pipe_now=*/true); |
| 66 | 69 |
| 67 // Convert the channel name to the pipe name. | 70 // Convert the channel name to the pipe name. |
| 68 std::string pipe_name(kChromePipeNamePrefix); | 71 std::string pipe_name(kChromePipeNamePrefix); |
| 69 pipe_name.append(channel_name); | 72 pipe_name.append(channel_name); |
| 70 | 73 |
| 71 SECURITY_ATTRIBUTES security_attributes = {0}; | 74 SECURITY_ATTRIBUTES security_attributes = {0}; |
| 72 security_attributes.nLength = sizeof(security_attributes); | 75 security_attributes.nLength = sizeof(security_attributes); |
| 73 security_attributes.lpSecurityDescriptor = nullptr; | 76 security_attributes.lpSecurityDescriptor = nullptr; |
| 74 security_attributes.bInheritHandle = TRUE; | 77 security_attributes.bInheritHandle = TRUE; |
| 75 | 78 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 PLOG(ERROR) | 133 PLOG(ERROR) |
| 131 << "Failed to create the server end of the Chromoting IPC channel"; | 134 << "Failed to create the server end of the Chromoting IPC channel"; |
| 132 return false; | 135 return false; |
| 133 } | 136 } |
| 134 | 137 |
| 135 *pipe_out = std::move(pipe); | 138 *pipe_out = std::move(pipe); |
| 136 return true; | 139 return true; |
| 137 } | 140 } |
| 138 | 141 |
| 139 } // namespace remoting | 142 } // namespace remoting |
| OLD | NEW |