1 // Copyright 2014 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 <memory> 9 #include <string> 10 #include <vector> 11 12 #include "base/component_export.h" 13 #include "base/memory/ref_counted.h" 14 #include "base/single_thread_task_runner.h" 15 #include "ipc/ipc_channel.h" 16 17 namespace IPC { 18 19 // Encapsulates how a Channel is created. A ChannelFactory can be 20 // passed to the constructor of ChannelProxy or SyncChannel to tell them 21 // how to create underlying channel. COMPONENT_EXPORT(IPC)22class COMPONENT_EXPORT(IPC) ChannelFactory { 23 public: 24 // Creates a factory for "native" channel built through 25 // IPC::Channel::Create(). 26 static std::unique_ptr<ChannelFactory> Create( 27 const ChannelHandle& handle, 28 Channel::Mode mode, 29 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); 30 31 virtual ~ChannelFactory() { } 32 virtual std::unique_ptr<Channel> BuildChannel(Listener* listener) = 0; 33 virtual scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() = 0; 34 }; 35 36 } // namespace IPC 37 38 #endif // IPC_IPC_CHANNEL_FACTORY_H_ 39