OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_CHANNEL_FACTORY_H_ | |
6 #define REMOTING_PROTOCOL_CHANNEL_FACTORY_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/threading/non_thread_safe.h" | |
11 | |
12 namespace net { | |
13 class Socket; | |
14 class StreamSocket; | |
15 } // namespace net | |
16 | |
17 namespace remoting { | |
18 namespace protocol { | |
19 | |
20 class ChannelFactory : public base::NonThreadSafe { | |
Wez
2012/08/06 23:14:07
nit: Why is NonThreadSafe part of this interface?
Sergey Ulanov
2012/08/07 20:12:22
To make it clear that this interface is not thread
| |
21 public: | |
22 // TODO(sergeyu): Specify connection error code when channel | |
23 // connection fails. | |
24 typedef base::Callback<void(scoped_ptr<net::StreamSocket>)> | |
25 StreamChannelCallback; | |
26 typedef base::Callback<void(scoped_ptr<net::Socket>)> | |
27 DatagramChannelCallback; | |
28 | |
29 ChannelFactory() {} | |
30 virtual ~ChannelFactory() {} | |
Wez
2012/08/06 23:14:07
Is the caller really responsible for the lifetime
Sergey Ulanov
2012/08/07 20:12:22
Done.
| |
31 | |
32 // Creates new channels for this connection. The specified callback | |
33 // is called when then new channel is created and connected. The | |
34 // callback is called with NULL if connection failed for any reason. | |
35 // All channels must be destroyed before the session is | |
36 // destroyed. Can be called only when in CONNECTING, CONNECTED or | |
37 // AUTHENTICATED states. | |
Wez
2012/08/06 23:14:07
nit: This comment refers to sessions and session s
Wez
2012/08/06 23:14:07
nit: Clarify that it's acceptable for implementati
Sergey Ulanov
2012/08/07 20:12:22
Cleaned up that comment.
Sergey Ulanov
2012/08/07 20:12:22
Done.
| |
38 virtual void CreateStreamChannel( | |
39 const std::string& name, const StreamChannelCallback& callback) = 0; | |
40 virtual void CreateDatagramChannel( | |
41 const std::string& name, const DatagramChannelCallback& callback) = 0; | |
42 | |
43 private: | |
44 DISALLOW_COPY_AND_ASSIGN(ChannelFactory); | |
45 }; | |
46 | |
47 } // namespace protocol | |
48 } // namespace remoting | |
49 | |
50 #endif // REMOTING_PROTOCOL_CHANNEL_FACTORY_H_ | |
OLD | NEW |