Chromium Code Reviews| Index: remoting/protocol/libjingle_transport_factory.cc | 
| diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc | 
| index 9e9e46208cad537cda89c03f3de2f76c02603f49..a91c712a517c66912ebc60c9d9a1882251ec1e69 100644 | 
| --- a/remoting/protocol/libjingle_transport_factory.cc | 
| +++ b/remoting/protocol/libjingle_transport_factory.cc | 
| @@ -6,6 +6,7 @@ | 
| #include "jingle/glue/channel_socket_adapter.h" | 
| #include "jingle/glue/pseudotcp_adapter.h" | 
| +#include "jingle/glue/utils.h" | 
| #include "net/base/net_errors.h" | 
| #include "remoting/protocol/channel_authenticator.h" | 
| #include "remoting/protocol/transport_config.h" | 
| @@ -51,6 +52,8 @@ class LibjingleStreamTransport : public StreamTransport, | 
| void OnRequestSignaling(); | 
| void OnCandidateReady(cricket::TransportChannelImpl* channel, | 
| const cricket::Candidate& candidate); | 
| + void OnRouteChange(cricket::TransportChannel* channel, | 
| + const cricket::Candidate& candidate); | 
| void OnTcpConnected(int result); | 
| void OnAuthenticationDone(net::Error error, | 
| @@ -156,6 +159,8 @@ void LibjingleStreamTransport::Connect( | 
| this, &LibjingleStreamTransport::OnRequestSignaling); | 
| channel_->SignalCandidateReady.connect( | 
| this, &LibjingleStreamTransport::OnCandidateReady); | 
| + channel_->SignalRouteChange.connect( | 
| + this, &LibjingleStreamTransport::OnRouteChange); | 
| channel_->Connect(); | 
| @@ -207,6 +212,40 @@ void LibjingleStreamTransport::OnCandidateReady( | 
| event_handler_->OnTransportCandidate(this, candidate); | 
| } | 
| +void LibjingleStreamTransport::OnRouteChange( | 
| + cricket::TransportChannel* channel, | 
| + const cricket::Candidate& candidate) { | 
| + TransportRoute route; | 
| + | 
| + if (candidate.type() == "local") { | 
| + route.type = TransportRoute::DIRECT; | 
| + } else if (candidate.type() == "stun") { | 
| + route.type = TransportRoute::STUN; | 
| + } else if (candidate.type() == "relay") { | 
| + route.type = TransportRoute::RELAY; | 
| + } else { | 
| + NOTREACHED(); | 
| 
 
Wez
2012/02/21 18:42:34
Is NOTREACHED() appropriate here?  It'll mean that
 
Sergey Ulanov
2012/02/21 19:47:19
Good point. Changed this to LOG(FATAL) that would
 
 | 
| + } | 
| + | 
| + if (!jingle_glue::SocketAddressToIPEndPoint( | 
| + candidate.address(), &route.remote_address)) { | 
| + NOTREACHED(); | 
| 
 
Wez
2012/02/21 18:42:34
Similarly here; since these notifications end up b
 
Sergey Ulanov
2012/02/21 19:47:19
Changed it to LOG(FATAL) too.
 
 | 
| + return; | 
| + } | 
| + | 
| + DCHECK(channel->GetP2PChannel()); | 
| + DCHECK(channel->GetP2PChannel()->best_connection()); | 
| + const cricket::Candidate& local_candidate = | 
| + channel->GetP2PChannel()->best_connection()->local_candidate(); | 
| + if (!jingle_glue::SocketAddressToIPEndPoint( | 
| + local_candidate.address(), &route.local_address)) { | 
| + NOTREACHED(); | 
| + return; | 
| + } | 
| + | 
| + event_handler_->OnTransportRouteChange(this, route); | 
| +} | 
| + | 
| void LibjingleStreamTransport::OnTcpConnected(int result) { | 
| DCHECK(CalledOnValidThread()); |