| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ice_transport_channel.h" | 5 #include "remoting/protocol/ice_transport_channel.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 transport_context_->network_settings().ice_timeout, | 127 transport_context_->network_settings().ice_timeout, |
| 128 this, &IceTransportChannel::TryReconnect); | 128 this, &IceTransportChannel::TryReconnect); |
| 129 | 129 |
| 130 base::ThreadTaskRunnerHandle::Get()->PostTask( | 130 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 131 FROM_HERE, base::Bind(&IceTransportChannel::NotifyConnected, | 131 FROM_HERE, base::Bind(&IceTransportChannel::NotifyConnected, |
| 132 weak_factory_.GetWeakPtr())); | 132 weak_factory_.GetWeakPtr())); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void IceTransportChannel::NotifyConnected() { | 135 void IceTransportChannel::NotifyConnected() { |
| 136 // Create P2PDatagramSocket adapter for the P2PTransportChannel. | 136 // Create P2PDatagramSocket adapter for the P2PTransportChannel. |
| 137 scoped_ptr<TransportChannelSocketAdapter> socket( | 137 std::unique_ptr<TransportChannelSocketAdapter> socket( |
| 138 new TransportChannelSocketAdapter(channel_.get())); | 138 new TransportChannelSocketAdapter(channel_.get())); |
| 139 socket->SetOnDestroyedCallback(base::Bind( | 139 socket->SetOnDestroyedCallback(base::Bind( |
| 140 &IceTransportChannel::OnChannelDestroyed, base::Unretained(this))); | 140 &IceTransportChannel::OnChannelDestroyed, base::Unretained(this))); |
| 141 base::ResetAndReturn(&callback_).Run(std::move(socket)); | 141 base::ResetAndReturn(&callback_).Run(std::move(socket)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag, | 144 void IceTransportChannel::SetRemoteCredentials(const std::string& ufrag, |
| 145 const std::string& password) { | 145 const std::string& password) { |
| 146 DCHECK(thread_checker_.CalledOnValidThread()); | 146 DCHECK(thread_checker_.CalledOnValidThread()); |
| 147 | 147 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 // Restart ICE by resetting ICE password. | 267 // Restart ICE by resetting ICE password. |
| 268 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH); | 268 std::string ice_password = rtc::CreateRandomString(cricket::ICE_PWD_LENGTH); |
| 269 delegate_->OnChannelIceCredentials(this, ice_username_fragment_, | 269 delegate_->OnChannelIceCredentials(this, ice_username_fragment_, |
| 270 ice_password); | 270 ice_password); |
| 271 channel_->SetIceCredentials(ice_username_fragment_, ice_password); | 271 channel_->SetIceCredentials(ice_username_fragment_, ice_password); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace protocol | 274 } // namespace protocol |
| 275 } // namespace remoting | 275 } // namespace remoting |
| OLD | NEW |