OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IPC_IPC_CHANNEL_FACTORY_H_ |
| 6 #define IPC_IPC_CHANNEL_FACTORY_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/message_loop.h" |
| 10 #include "ipc/ipc_channel_handle.h" |
| 11 |
| 12 namespace IPC { |
| 13 |
| 14 class ChannelFactory : public MessageLoopForIO::Watcher { |
| 15 public: |
| 16 class Delegate { |
| 17 public: |
| 18 // Called when a client connects to the factory. |
| 19 virtual void OnClientConnected(const ChannelHandle& handle) = 0; |
| 20 }; |
| 21 |
| 22 ChannelFactory(const std::string& path, Delegate* delegate); |
| 23 |
| 24 bool Listen(); |
| 25 private: |
| 26 bool CreatePipe(); |
| 27 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
| 28 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {} |
| 29 |
| 30 MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; |
| 31 base::FilePath path_; |
| 32 Delegate* delegate_; |
| 33 int listen_pipe_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(ChannelFactory); |
| 36 }; |
| 37 |
| 38 } |
| 39 |
| 40 #endif // IPC_IPC_CHANNEL_FACTORY_H_ |
OLD | NEW |