summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/pepper_session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/protocol/pepper_session.cc')
-rw-r--r--remoting/protocol/pepper_session.cc63
1 files changed, 27 insertions, 36 deletions
diff --git a/remoting/protocol/pepper_session.cc b/remoting/protocol/pepper_session.cc
index 2ac5c15..614e9c6 100644
--- a/remoting/protocol/pepper_session.cc
+++ b/remoting/protocol/pepper_session.cc
@@ -11,10 +11,10 @@
#include "remoting/base/constants.h"
#include "remoting/jingle_glue/iq_sender.h"
#include "remoting/protocol/authenticator.h"
-#include "remoting/protocol/channel_authenticator.h"
#include "remoting/protocol/content_description.h"
#include "remoting/protocol/jingle_messages.h"
#include "remoting/protocol/pepper_session_manager.h"
+#include "remoting/protocol/pepper_stream_channel.h"
#include "third_party/libjingle/source/talk/p2p/base/candidate.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
@@ -121,27 +121,19 @@ void PepperSession::CreateStreamChannel(
scoped_ptr<ChannelAuthenticator> channel_authenticator =
authenticator_->CreateChannelAuthenticator();
- scoped_ptr<StreamTransport> channel =
- session_manager_->transport_factory_->CreateStreamTransport();
- channel->Initialize(name, session_manager_->transport_config_,
- this, channel_authenticator.Pass());
- channel->Connect(callback);
- channels_[name] = channel.release();
+ PepperStreamChannel* channel = new PepperStreamChannel(
+ this, name, callback);
+ channels_[name] = channel;
+ channel->Connect(session_manager_->pp_instance_,
+ session_manager_->transport_config_,
+ channel_authenticator.Pass());
}
void PepperSession::CreateDatagramChannel(
const std::string& name,
const DatagramChannelCallback& callback) {
- DCHECK(!channels_[name]);
-
- scoped_ptr<ChannelAuthenticator> channel_authenticator =
- authenticator_->CreateChannelAuthenticator();
- scoped_ptr<DatagramTransport> channel =
- session_manager_->transport_factory_->CreateDatagramTransport();
- channel->Initialize(name, session_manager_->transport_config_,
- this, channel_authenticator.Pass());
- channel->Connect(callback);
- channels_[name] = channel.release();
+ // TODO(sergeyu): Implement datagram channel support.
+ NOTREACHED();
}
void PepperSession::CancelChannelCreation(const std::string& name) {
@@ -188,25 +180,6 @@ void PepperSession::Close() {
CloseInternal(false);
}
-void PepperSession::OnTransportCandidate(Transport* transport,
- const cricket::Candidate& candidate) {
- pending_candidates_.push_back(candidate);
-
- if (!transport_infos_timer_.IsRunning()) {
- // Delay sending the new candidates in case we get more candidates
- // that we can send in one message.
- transport_infos_timer_.Start(
- FROM_HERE, base::TimeDelta::FromMilliseconds(kTransportInfoSendDelayMs),
- this, &PepperSession::SendTransportInfo);
- }
-}
-
-void PepperSession::OnTransportDeleted(Transport* transport) {
- ChannelsMap::iterator it = channels_.find(transport->name());
- DCHECK_EQ(it->second, transport);
- channels_.erase(it);
-}
-
void PepperSession::OnIncomingMessage(const JingleMessage& message,
JingleMessageReply* reply) {
DCHECK(CalledOnValidThread());
@@ -401,6 +374,18 @@ void PepperSession::OnSessionInfoResponse(const buzz::XmlElement* response) {
}
}
+void PepperSession::AddLocalCandidate(const cricket::Candidate& candidate) {
+ pending_candidates_.push_back(candidate);
+
+ if (!transport_infos_timer_.IsRunning()) {
+ // Delay sending the new candidates in case we get more candidates
+ // that we can send in one message.
+ transport_infos_timer_.Start(
+ FROM_HERE, base::TimeDelta::FromMilliseconds(kTransportInfoSendDelayMs),
+ this, &PepperSession::SendTransportInfo);
+ }
+}
+
void PepperSession::OnTransportInfoResponse(const buzz::XmlElement* response) {
const std::string& type = response->Attr(buzz::QName("", "type"));
if (type != "result") {
@@ -417,6 +402,12 @@ void PepperSession::OnTransportInfoResponse(const buzz::XmlElement* response) {
}
}
+void PepperSession::OnDeleteChannel(PepperChannel* channel) {
+ ChannelsMap::iterator it = channels_.find(channel->name());
+ DCHECK_EQ(it->second, channel);
+ channels_.erase(it);
+}
+
void PepperSession::SendTransportInfo() {
JingleMessage message(peer_jid_, JingleMessage::TRANSPORT_INFO, session_id_);
message.candidates.swap(pending_candidates_);