| 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/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 bool JingleSession::is_session_active() { | 762 bool JingleSession::is_session_active() { |
| 763 return state_ == CONNECTING || state_ == ACCEPTING || state_ == ACCEPTED || | 763 return state_ == CONNECTING || state_ == ACCEPTING || state_ == ACCEPTED || |
| 764 state_ == AUTHENTICATING || state_ == AUTHENTICATED; | 764 state_ == AUTHENTICATING || state_ == AUTHENTICATED; |
| 765 } | 765 } |
| 766 | 766 |
| 767 void JingleSession::ProcessIncomingPluginMessage( | 767 void JingleSession::ProcessIncomingPluginMessage( |
| 768 const JingleMessage& message) { | 768 const JingleMessage& message) { |
| 769 if (!message.attachments) { | 769 if (!message.attachments) { |
| 770 return; | 770 return; |
| 771 } | 771 } |
| 772 for (const auto& plugin : plugins_) { | 772 for (auto* plugin : plugins_) { |
| 773 plugin->OnIncomingMessage(*(message.attachments)); | 773 plugin->OnIncomingMessage(*(message.attachments)); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 | 776 |
| 777 void JingleSession::AddPluginAttachments(JingleMessage* message) { | 777 void JingleSession::AddPluginAttachments(JingleMessage* message) { |
| 778 DCHECK(message); | 778 DCHECK(message); |
| 779 for (const auto& plugin : plugins_) { | 779 for (auto* plugin : plugins_) { |
| 780 std::unique_ptr<XmlElement> attachment = plugin->GetNextMessage(); | 780 std::unique_ptr<XmlElement> attachment = plugin->GetNextMessage(); |
| 781 if (attachment) { | 781 if (attachment) { |
| 782 message->AddAttachment(std::move(attachment)); | 782 message->AddAttachment(std::move(attachment)); |
| 783 } | 783 } |
| 784 } | 784 } |
| 785 } | 785 } |
| 786 | 786 |
| 787 void JingleSession::SendSessionInitiateMessage() { | 787 void JingleSession::SendSessionInitiateMessage() { |
| 788 if (state_ != CONNECTING) { | 788 if (state_ != CONNECTING) { |
| 789 return; | 789 return; |
| 790 } | 790 } |
| 791 std::unique_ptr<JingleMessage> message(new JingleMessage( | 791 std::unique_ptr<JingleMessage> message(new JingleMessage( |
| 792 peer_address_, JingleMessage::SESSION_INITIATE, session_id_)); | 792 peer_address_, JingleMessage::SESSION_INITIATE, session_id_)); |
| 793 message->initiator = session_manager_->signal_strategy_->GetLocalJid(); | 793 message->initiator = session_manager_->signal_strategy_->GetLocalJid(); |
| 794 message->description.reset(new ContentDescription( | 794 message->description.reset(new ContentDescription( |
| 795 session_manager_->protocol_config_->Clone(), | 795 session_manager_->protocol_config_->Clone(), |
| 796 authenticator_->GetNextMessage())); | 796 authenticator_->GetNextMessage())); |
| 797 SendMessage(std::move(message)); | 797 SendMessage(std::move(message)); |
| 798 } | 798 } |
| 799 | 799 |
| 800 std::string JingleSession::GetNextOutgoingId() { | 800 std::string JingleSession::GetNextOutgoingId() { |
| 801 return outgoing_id_prefix_ + "_" + base::IntToString(++next_outgoing_id_); | 801 return outgoing_id_prefix_ + "_" + base::IntToString(++next_outgoing_id_); |
| 802 } | 802 } |
| 803 | 803 |
| 804 } // namespace protocol | 804 } // namespace protocol |
| 805 } // namespace remoting | 805 } // namespace remoting |
| OLD | NEW |