| 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_stream_connector.h" | 5 #include "remoting/protocol/jingle_stream_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "jingle/glue/channel_socket_adapter.h" | 8 #include "jingle/glue/channel_socket_adapter.h" |
| 9 #include "jingle/glue/pseudotcp_adapter.h" | 9 #include "jingle/glue/pseudotcp_adapter.h" |
| 10 #include "net/base/cert_status_flags.h" | 10 #include "net/base/cert_status_flags.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const Session::StreamChannelCallback& callback) | 40 const Session::StreamChannelCallback& callback) |
| 41 : session_(session), | 41 : session_(session), |
| 42 name_(name), | 42 name_(name), |
| 43 callback_(callback), | 43 callback_(callback), |
| 44 raw_channel_(NULL) { | 44 raw_channel_(NULL) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 JingleStreamConnector::~JingleStreamConnector() { | 47 JingleStreamConnector::~JingleStreamConnector() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void JingleStreamConnector::Connect(ChannelAuthenticator* authenticator, | 50 void JingleStreamConnector::Connect( |
| 51 cricket::TransportChannel* raw_channel) { | 51 scoped_ptr<ChannelAuthenticator> authenticator, |
| 52 cricket::TransportChannel* raw_channel) { |
| 52 DCHECK(CalledOnValidThread()); | 53 DCHECK(CalledOnValidThread()); |
| 53 DCHECK(!raw_channel_); | 54 DCHECK(!raw_channel_); |
| 54 | 55 |
| 55 authenticator_.reset(authenticator); | 56 authenticator_ = authenticator.Pass(); |
| 56 raw_channel_ = raw_channel; | 57 raw_channel_ = raw_channel; |
| 57 | 58 |
| 58 net::Socket* socket = | 59 net::Socket* socket = |
| 59 new jingle_glue::TransportChannelSocketAdapter(raw_channel_); | 60 new jingle_glue::TransportChannelSocketAdapter(raw_channel_); |
| 60 | 61 |
| 61 if (!EstablishTCPConnection(socket)) | 62 if (!EstablishTCPConnection(socket)) |
| 62 NotifyError(); | 63 NotifyError(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 bool JingleStreamConnector::EstablishTCPConnection(net::Socket* socket) { | 66 bool JingleStreamConnector::EstablishTCPConnection(net::Socket* socket) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 callback_.Run(socket); | 122 callback_.Run(socket); |
| 122 delete this; | 123 delete this; |
| 123 } | 124 } |
| 124 | 125 |
| 125 void JingleStreamConnector::NotifyError() { | 126 void JingleStreamConnector::NotifyError() { |
| 126 NotifyDone(NULL); | 127 NotifyDone(NULL); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace protocol | 130 } // namespace protocol |
| 130 } // namespace remoting | 131 } // namespace remoting |
| OLD | NEW |