| 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/pepper_session.h" | 5 #include "remoting/protocol/pepper_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 const std::string& PepperSession::shared_secret() { | 186 const std::string& PepperSession::shared_secret() { |
| 187 DCHECK(CalledOnValidThread()); | 187 DCHECK(CalledOnValidThread()); |
| 188 return shared_secret_; | 188 return shared_secret_; |
| 189 } | 189 } |
| 190 | 190 |
| 191 void PepperSession::Close() { | 191 void PepperSession::Close() { |
| 192 DCHECK(CalledOnValidThread()); | 192 DCHECK(CalledOnValidThread()); |
| 193 | 193 |
| 194 // Ensure that we won't notify the callback again. |
| 195 state_change_callback_.Reset(); |
| 196 |
| 194 if (state_ == CONNECTING || state_ == CONNECTED || | 197 if (state_ == CONNECTING || state_ == CONNECTED || |
| 195 state_ == CONNECTED_CHANNELS) { | 198 state_ == CONNECTED_CHANNELS) { |
| 196 // Send session-terminate message. | 199 // Send session-terminate message. |
| 197 JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE, | 200 JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE, |
| 198 session_id_); | 201 session_id_); |
| 199 scoped_ptr<IqRequest> terminate_request( | 202 scoped_ptr<IqRequest> terminate_request( |
| 200 session_manager_->iq_sender()->SendIq( | 203 session_manager_->iq_sender()->SendIq( |
| 201 message.ToXml(), IqSender::ReplyCallback())); | 204 message.ToXml(), IqSender::ReplyCallback())); |
| 202 } | 205 } |
| 203 | 206 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 DCHECK_NE(state_, FAILED); | 404 DCHECK_NE(state_, FAILED); |
| 402 | 405 |
| 403 state_ = new_state; | 406 state_ = new_state; |
| 404 if (!state_change_callback_.is_null()) | 407 if (!state_change_callback_.is_null()) |
| 405 state_change_callback_.Run(new_state); | 408 state_change_callback_.Run(new_state); |
| 406 } | 409 } |
| 407 } | 410 } |
| 408 | 411 |
| 409 } // namespace protocol | 412 } // namespace protocol |
| 410 } // namespace remoting | 413 } // namespace remoting |
| OLD | NEW |