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.
5 #ifndef REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
6 #define REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
10 #include "base/callback_forward.h"
19 class DatagramChannelFactory
{
21 typedef base::Callback
<void(scoped_ptr
<net::Socket
>)>
22 ChannelCreatedCallback
;
24 DatagramChannelFactory() {}
26 // Creates new channels and calls the |callback| when then new channel is
27 // created and connected. The |callback| is called with nullptr if channel
28 // setup failed for any reason. Callback may be called synchronously, before
29 // the call returns. All channels must be destroyed, and
30 // CancelChannelCreation() called for any pending channels, before the factory
32 virtual void CreateChannel(const std::string
& name
,
33 const ChannelCreatedCallback
& callback
) = 0;
35 // Cancels a pending CreateChannel() operation for the named channel. If the
36 // channel creation already completed then canceling it has no effect. When
37 // shutting down this method must be called for each channel pending creation.
38 virtual void CancelChannelCreation(const std::string
& name
) = 0;
41 virtual ~DatagramChannelFactory() {}
44 DISALLOW_COPY_AND_ASSIGN(DatagramChannelFactory
);
47 } // namespace protocol
48 } // namespace remoting
50 #endif // REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_