OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/jingle_datagram_connector.h" | 5 #include "remoting/protocol/jingle_datagram_connector.h" |
6 | 6 |
7 #include "jingle/glue/channel_socket_adapter.h" | 7 #include "jingle/glue/channel_socket_adapter.h" |
8 #include "remoting/protocol/channel_authenticator.h" | 8 #include "remoting/protocol/channel_authenticator.h" |
9 #include "remoting/protocol/jingle_session.h" | 9 #include "remoting/protocol/jingle_session.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 namespace protocol { | 12 namespace protocol { |
13 | 13 |
14 JingleDatagramConnector::JingleDatagramConnector( | 14 JingleDatagramConnector::JingleDatagramConnector( |
15 JingleSession* session, | 15 JingleSession* session, |
16 const std::string& name, | 16 const std::string& name, |
17 const Session::DatagramChannelCallback& callback) | 17 const Session::DatagramChannelCallback& callback) |
18 : session_(session), | 18 : session_(session), |
19 name_(name), | 19 name_(name), |
20 callback_(callback) { | 20 callback_(callback) { |
21 } | 21 } |
22 | 22 |
23 JingleDatagramConnector::~JingleDatagramConnector() { | 23 JingleDatagramConnector::~JingleDatagramConnector() { |
24 } | 24 } |
25 | 25 |
26 void JingleDatagramConnector::Connect( | 26 void JingleDatagramConnector::Connect( |
27 ChannelAuthenticator* authenticator, | 27 scoped_ptr<ChannelAuthenticator> authenticator, |
28 cricket::TransportChannel* raw_channel) { | 28 cricket::TransportChannel* raw_channel) { |
29 DCHECK(CalledOnValidThread()); | 29 DCHECK(CalledOnValidThread()); |
30 | 30 |
31 authenticator_.reset(authenticator); | 31 authenticator_ = authenticator.Pass(); |
32 | 32 |
33 net::Socket* socket = | 33 net::Socket* socket = |
34 new jingle_glue::TransportChannelSocketAdapter(raw_channel); | 34 new jingle_glue::TransportChannelSocketAdapter(raw_channel); |
35 | 35 |
36 // TODO(sergeyu): Implement encryption for datagram channels. | 36 // TODO(sergeyu): Implement encryption for datagram channels. |
37 | 37 |
38 session_->OnChannelConnectorFinished(name_, this); | 38 session_->OnChannelConnectorFinished(name_, this); |
39 callback_.Run(socket); | 39 callback_.Run(socket); |
40 delete this; | 40 delete this; |
41 } | 41 } |
42 | 42 |
43 } // namespace protocol | 43 } // namespace protocol |
44 } // namespace remoting | 44 } // namespace remoting |
OLD | NEW |