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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Generate a unique name for the channel. | 44 // Generate a unique name for the channel. |
45 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 45 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
46 | 46 |
47 // Create the server end of the channel. | 47 // Create the server end of the channel. |
48 ScopedHandle pipe; | 48 ScopedHandle pipe; |
49 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { | 49 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { |
50 return false; | 50 return false; |
51 } | 51 } |
52 | 52 |
53 // Wrap the pipe into an IPC channel. | 53 // Wrap the pipe into an IPC channel. |
54 scoped_ptr<IPC::ChannelProxy> server(new IPC::ChannelProxy( | 54 scoped_ptr<IPC::ChannelProxy> server = IPC::ChannelProxy::CreateServer( |
55 IPC::ChannelHandle(pipe), | 55 IPC::ChannelHandle(pipe), |
56 IPC::Channel::MODE_SERVER, | |
57 listener, | 56 listener, |
58 io_task_runner)); | 57 io_task_runner); |
59 | 58 |
60 // Convert the channel name to the pipe name. | 59 // Convert the channel name to the pipe name. |
61 std::string pipe_name(kChromePipeNamePrefix); | 60 std::string pipe_name(kChromePipeNamePrefix); |
62 pipe_name.append(channel_name); | 61 pipe_name.append(channel_name); |
63 | 62 |
64 SECURITY_ATTRIBUTES security_attributes = {0}; | 63 SECURITY_ATTRIBUTES security_attributes = {0}; |
65 security_attributes.nLength = sizeof(security_attributes); | 64 security_attributes.nLength = sizeof(security_attributes); |
66 security_attributes.lpSecurityDescriptor = NULL; | 65 security_attributes.lpSecurityDescriptor = NULL; |
67 security_attributes.bInheritHandle = TRUE; | 66 security_attributes.bInheritHandle = TRUE; |
68 | 67 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 PLOG(ERROR) | 123 PLOG(ERROR) |
125 << "Failed to create the server end of the Chromoting IPC channel"; | 124 << "Failed to create the server end of the Chromoting IPC channel"; |
126 return false; | 125 return false; |
127 } | 126 } |
128 | 127 |
129 *pipe_out = pipe.Pass(); | 128 *pipe_out = pipe.Pass(); |
130 return true; | 129 return true; |
131 } | 130 } |
132 | 131 |
133 } // namespace remoting | 132 } // namespace remoting |
OLD | NEW |