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

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

Issue 2907073003: [Chromoting] Add DataChannelManager to manage optional incoming data channels (Closed)
Patch Set: Fix test failure without DCHECK 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
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 #include "remoting/protocol/data_channel_manager.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "remoting/protocol/message_pipe.h"
11
12 namespace remoting {
13 namespace protocol {
14
15 DataChannelManager::DataChannelManager() = default;
16 DataChannelManager::~DataChannelManager() = default;
17
18 void DataChannelManager::RegisterCreateHandlerCallback(
19 const std::string& prefix,
20 CreateHandlerCallback constructor) {
21 DCHECK(!prefix.empty());
22 DCHECK(constructor);
23 constructors_.push_back(std::make_pair(prefix, constructor));
24 }
25
26 bool DataChannelManager::OnIncomingDataChannel(
27 const std::string& name,
28 std::unique_ptr<MessagePipe> pipe) {
29 for (auto& constructor : constructors_) {
30 if (name.find(constructor.first) == 0) {
31 constructor.second.Run(name, std::move(pipe));
32 return true;
33 }
34 }
35 return false;
36 }
37
38 } // namespace protocol
39 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/data_channel_manager.h ('k') | remoting/protocol/data_channel_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698