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

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

Issue 2967793002: [Chromoting] Remove DataChannelManagerCallbacks constructor parameter of ClientSession (Closed)
Patch Set: Resolve review comments Created 3 years, 5 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/data_channel_manager.h ('k') | remoting/test/it2me_standalone_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/data_channel_manager.h" 5 #include "remoting/protocol/data_channel_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "remoting/protocol/message_pipe.h" 10 #include "remoting/protocol/message_pipe.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 namespace protocol { 13 namespace protocol {
14 14
15 DataChannelManager::DataChannelManager() = default; 15 DataChannelManager::DataChannelManager() = default;
16 DataChannelManager::~DataChannelManager() = default; 16 DataChannelManager::~DataChannelManager() = default;
17 17
18 void DataChannelManager::RegisterCreateHandlerCallback( 18 void DataChannelManager::RegisterCreateHandlerCallback(
19 const std::string& prefix, 19 const std::string& prefix,
20 CreateHandlerCallback constructor) { 20 CreateHandlerCallback constructor) {
21 DCHECK(!prefix.empty()); 21 DCHECK(!prefix.empty());
22 DCHECK(constructor); 22 DCHECK(constructor);
23 constructors_.push_back(std::make_pair(prefix, constructor)); 23 constructors_.push_back(std::make_pair(prefix, std::move(constructor)));
24 } 24 }
25 25
26 bool DataChannelManager::OnIncomingDataChannel( 26 bool DataChannelManager::OnIncomingDataChannel(
27 const std::string& name, 27 const std::string& name,
28 std::unique_ptr<MessagePipe> pipe) { 28 std::unique_ptr<MessagePipe> pipe) {
29 for (auto& constructor : constructors_) { 29 for (auto& constructor : constructors_) {
30 if (name.find(constructor.first) == 0) { 30 if (name.find(constructor.first) == 0) {
31 constructor.second.Run(name, std::move(pipe)); 31 constructor.second.Run(name, std::move(pipe));
32 return true; 32 return true;
33 } 33 }
34 } 34 }
35 return false; 35 return false;
36 } 36 }
37 37
38 } // namespace protocol 38 } // namespace protocol
39 } // namespace remoting 39 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/data_channel_manager.h ('k') | remoting/test/it2me_standalone_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698