Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/connection_to_host.h" | 5 #include "remoting/protocol/connection_to_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 CloseOnError(session_->error()); | 202 CloseOnError(session_->error()); |
| 203 } | 203 } |
| 204 break; | 204 break; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 void ConnectionToHost::OnSessionRouteChange(const std::string& channel_name, | 208 void ConnectionToHost::OnSessionRouteChange(const std::string& channel_name, |
| 209 const TransportRoute& route) { | 209 const TransportRoute& route) { |
| 210 } | 210 } |
| 211 | 211 |
| 212 void ConnectionToHost::OnSessionChannelReady(const std::string& channel_name, | |
| 213 bool ready) { | |
| 214 if (ready) { | |
| 215 not_ready_channels_.erase(channel_name); | |
|
Wez
2012/07/17 01:47:50
Should we set |not_ready_channels_| to contain all
Sergey Ulanov
2012/07/18 00:52:07
I don't think it's necessary because we know that
| |
| 216 } else if (!ready) { | |
| 217 not_ready_channels_.insert(channel_name); | |
| 218 } | |
| 219 | |
| 220 if (ready && not_ready_channels_.size() == 0U) { | |
|
Wez
2012/07/17 01:47:50
Can't this entire block be event_callback_.OnConne
Sergey Ulanov
2012/07/18 00:52:07
Done.
| |
| 221 event_callback_->OnConnectionReady(true); | |
| 222 } else if (!ready && not_ready_channels_.size() == 1U) { | |
| 223 event_callback_->OnConnectionReady(false); | |
| 224 } | |
| 225 } | |
| 226 | |
| 212 ConnectionToHost::State ConnectionToHost::state() const { | 227 ConnectionToHost::State ConnectionToHost::state() const { |
| 213 return state_; | 228 return state_; |
| 214 } | 229 } |
| 215 | 230 |
| 216 void ConnectionToHost::OnChannelInitialized(bool successful) { | 231 void ConnectionToHost::OnChannelInitialized(bool successful) { |
| 217 if (!successful) { | 232 if (!successful) { |
| 218 LOG(ERROR) << "Failed to connect video channel"; | 233 LOG(ERROR) << "Failed to connect video channel"; |
| 219 CloseOnError(CHANNEL_CONNECTION_ERROR); | 234 CloseOnError(CHANNEL_CONNECTION_ERROR); |
| 220 return; | 235 return; |
| 221 } | 236 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 | 279 |
| 265 if (state != state_) { | 280 if (state != state_) { |
| 266 state_ = state; | 281 state_ = state; |
| 267 error_ = error; | 282 error_ = error; |
| 268 event_callback_->OnConnectionState(state_, error_); | 283 event_callback_->OnConnectionState(state_, error_); |
| 269 } | 284 } |
| 270 } | 285 } |
| 271 | 286 |
| 272 } // namespace protocol | 287 } // namespace protocol |
| 273 } // namespace remoting | 288 } // namespace remoting |
| OLD | NEW |