Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: remoting/protocol/data_channel_manager.h

Issue 2907073003: [Chromoting] Add DataChannelManager to manage optional incoming data channels (Closed)
Patch Set: Remove return value of Send() function and asynchronously destruction. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/data_channel_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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_DATA_CHANNEL_MANAGER_H_
6 #define REMOTING_PROTOCOL_DATA_CHANNEL_MANAGER_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback.h"
13
14 namespace remoting {
15 namespace protocol {
16
17 class MessagePipe;
18
19 // DataChannelManager helps to manage optional data channels. Consumers can
20 // register a function to handle data from a named data channel.
21 class DataChannelManager final {
22 public:
23 using CreateHandlerCallback = base::Callback<void(
24 const std::string& name,
25 std::unique_ptr<MessagePipe> pipe)>;
26
27 DataChannelManager();
28 ~DataChannelManager();
29
30 // Registers a factory function to handle a new incoming data channel with a
31 // name matching |prefix|. Both |constructor| and |prefix| cannot be empty.
32 void RegisterCreateHandlerCallback(const std::string& prefix,
33 CreateHandlerCallback constructor);
34
35 // Executes the registerd callback to handle the new incoming data channel.
joedow 2017/06/09 03:29:47 s/registerd/registered
Hzj_jie 2017/06/09 17:52:54 Done.
36 // Returns true if a handler of the new data channel has been executed.
37 bool OnIncomingDataChannel(const std::string& name,
38 std::unique_ptr<MessagePipe> pipe);
39
40 private:
41 std::vector<std::pair<std::string, CreateHandlerCallback>> constructors_;
42 };
43
44 } // namespace protocol
45 } // namespace remoting
46
47 #endif // REMOTING_PROTOCOL_DATA_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/data_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698