Chromium Code Reviews| Index: remoting/protocol/jingle_session.cc |
| diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
| index 1b3c1a930448e986e406be8a3bda8af6c3ef9e63..feaebea2c685f23809c9c7bf805ae628a3c8581f 100644 |
| --- a/remoting/protocol/jingle_session.cc |
| +++ b/remoting/protocol/jingle_session.cc |
| @@ -7,11 +7,15 @@ |
| #include "base/base64.h" |
| #include "base/bind.h" |
| #include "base/location.h" |
| +#include "base/logging.h" |
| #include "base/message_loop_proxy.h" |
| #include "base/rand_util.h" |
| #include "base/stl_util.h" |
| #include "crypto/hmac.h" |
| +#include "jingle/glue/utils.h" |
| +#include "net/base/ip_endpoint.h" |
| #include "net/base/net_errors.h" |
| +#include "net/base/net_util.h" |
| #include "net/socket/stream_socket.h" |
| #include "remoting/base/constants.h" |
| #include "remoting/protocol/auth_util.h" |
| @@ -132,6 +136,13 @@ void JingleSession::SetStateChangeCallback( |
| state_change_callback_ = callback; |
| } |
| +void JingleSession::SetRouteChangeCallback( |
| + const RouteChangeCallback& callback) { |
| + DCHECK(CalledOnValidThread()); |
| + DCHECK(!callback.is_null()); |
|
Sergey Ulanov
2012/01/23 20:33:37
I don't think we need this DCHECK. The caller may
Lambros
2012/01/24 19:50:50
Done.
|
| + route_change_callback_ = callback; |
| +} |
| + |
| Session::Error JingleSession::error() { |
| DCHECK(CalledOnValidThread()); |
| return error_; |
| @@ -466,6 +477,8 @@ void JingleSession::AddChannelConnector( |
| cricket::TransportChannel* raw_channel = |
| cricket_session_->CreateChannel(content_name, name); |
| + raw_channel->SignalRouteChange.connect(this, &JingleSession::OnRouteChange); |
| + |
| if (!jingle_session_manager_->allow_nat_traversal_ && |
| !cricket_session_->initiator()) { |
| // Don't make outgoing connections from the host to client when |
| @@ -491,6 +504,19 @@ void JingleSession::OnChannelConnectorFinished( |
| channel_connectors_.erase(name); |
| } |
| +void JingleSession::OnRouteChange(cricket::TransportChannel* channel, |
| + const cricket::Candidate& candidate) { |
| + net::IPEndPoint end_point; |
| + if (!jingle_glue::SocketAddressToIPEndPoint(candidate.address(), |
| + &end_point)) { |
| + NOTREACHED(); |
| + return; |
| + } |
| + |
| + if (!route_change_callback_.is_null()) |
| + route_change_callback_.Run(channel->name(), end_point); |
| +} |
| + |
| const cricket::ContentInfo* JingleSession::GetContentInfo() const { |
| const cricket::SessionDescription* session_description; |
| // If we initiate the session, we get to specify the content name. When |