OLD | NEW |
| (Empty) |
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 REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
6 #define REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
7 | |
8 namespace net { | |
9 class Socket; | |
10 } // namespace net | |
11 | |
12 namespace remoting { | |
13 namespace protocol { | |
14 | |
15 class DatagramChannelFactory { | |
16 public: | |
17 typedef base::Callback<void(scoped_ptr<net::Socket>)> | |
18 ChannelCreatedCallback; | |
19 | |
20 DatagramChannelFactory() {} | |
21 | |
22 // Creates new channels and calls the |callback| when then new channel is | |
23 // created and connected. The |callback| is called with NULL if channel setup | |
24 // failed for any reason. Callback may be called synchronously, before the | |
25 // call returns. All channels must be destroyed, and CancelChannelCreation() | |
26 // called for any pending channels, before the factory is destroyed. | |
27 virtual void CreateChannel(const std::string& name, | |
28 const ChannelCreatedCallback& callback) = 0; | |
29 | |
30 // Cancels a pending CreateChannel() operation for the named channel. If the | |
31 // channel creation already completed then canceling it has no effect. When | |
32 // shutting down this method must be called for each channel pending creation. | |
33 virtual void CancelChannelCreation(const std::string& name) = 0; | |
34 | |
35 protected: | |
36 virtual ~DatagramChannelFactory() {} | |
37 | |
38 private: | |
39 DISALLOW_COPY_AND_ASSIGN(DatagramChannelFactory); | |
40 }; | |
41 | |
42 } // namespace protocol | |
43 } // namespace remoting | |
44 | |
45 #endif // REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
OLD | NEW |