| 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 #ifndef REMOTING_HOST_IPC_UTIL_H_ | 5 #ifndef REMOTING_HOST_IPC_UTIL_H_ |
| 6 #define REMOTING_HOST_IPC_UTIL_H_ | 6 #define REMOTING_HOST_IPC_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 9 #include <string> | 8 #include <string> |
| 10 | 9 |
| 11 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 14 #include "ipc/ipc_platform_file.h" | |
| 15 | 12 |
| 16 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 17 #include "base/win/scoped_handle.h" | 14 #include "base/win/scoped_handle.h" |
| 18 #endif // defined(OS_WIN) | 15 #endif // defined(OS_WIN) |
| 19 | 16 |
| 20 namespace base { | |
| 21 class File; | |
| 22 class SingleThreadTaskRunner; | |
| 23 } // namespace base | |
| 24 | |
| 25 namespace IPC { | |
| 26 class ChannelProxy; | |
| 27 class Listener; | |
| 28 } // namespace IPC | |
| 29 | |
| 30 namespace remoting { | 17 namespace remoting { |
| 31 | 18 |
| 32 // Creates an already connected IPC channel. The server end of the channel | |
| 33 // is wrapped into a channel proxy that will invoke methods of |listener| | |
| 34 // on the caller's thread while using |io_task_runner| to send and receive | |
| 35 // messages in the background. The client end is returned as a pipe handle | |
| 36 // (inheritable on Windows). | |
| 37 // The channel is registered with the global AttachmentBroker. | |
| 38 bool CreateConnectedIpcChannel( | |
| 39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | |
| 40 IPC::Listener* listener, | |
| 41 base::File* client_out, | |
| 42 std::unique_ptr<IPC::ChannelProxy>* server_out); | |
| 43 | |
| 44 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 45 | 20 |
| 46 // Creates the server end of the IPC channel and applies the security | 21 // Creates the server end of the IPC channel and applies the security |
| 47 // descriptor |pipe_security_descriptor| to it. | 22 // descriptor |pipe_security_descriptor| to it. |
| 48 bool CreateIpcChannel( | 23 bool CreateIpcChannel( |
| 49 const std::string& channel_name, | 24 const std::string& channel_name, |
| 50 const std::string& pipe_security_descriptor, | 25 const std::string& pipe_security_descriptor, |
| 51 base::win::ScopedHandle* pipe_out); | 26 base::win::ScopedHandle* pipe_out); |
| 52 | 27 |
| 53 #endif // defined(OS_WIN) | 28 #endif // defined(OS_WIN) |
| 54 | 29 |
| 55 } // namespace remoting | 30 } // namespace remoting |
| 56 | 31 |
| 57 #endif // REMOTING_HOST_IPC_UTIL_H_ | 32 #endif // REMOTING_HOST_IPC_UTIL_H_ |
| OLD | NEW |