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