Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: remoting/protocol/jingle_session_manager.cc

Issue 1412313006: Remove remoting::protocol::Transport interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@transport_session.h
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_manager.h" 5 #include "remoting/protocol/jingle_session_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "remoting/protocol/authenticator.h" 8 #include "remoting/protocol/authenticator.h"
9 #include "remoting/protocol/content_description.h" 9 #include "remoting/protocol/content_description.h"
10 #include "remoting/protocol/jingle_messages.h" 10 #include "remoting/protocol/jingle_messages.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void JingleSessionManager::set_protocol_config( 47 void JingleSessionManager::set_protocol_config(
48 scoped_ptr<CandidateSessionConfig> config) { 48 scoped_ptr<CandidateSessionConfig> config) {
49 protocol_config_ = config.Pass(); 49 protocol_config_ = config.Pass();
50 } 50 }
51 51
52 scoped_ptr<Session> JingleSessionManager::Connect( 52 scoped_ptr<Session> JingleSessionManager::Connect(
53 const std::string& host_jid, 53 const std::string& host_jid,
54 scoped_ptr<Authenticator> authenticator) { 54 scoped_ptr<Authenticator> authenticator) {
55 // Notify |transport_factory_| that it may be used soon.
56 transport_factory_->PrepareTokens();
57
58 scoped_ptr<JingleSession> session(new JingleSession(this)); 55 scoped_ptr<JingleSession> session(new JingleSession(this));
59 session->StartConnection(host_jid, authenticator.Pass()); 56 session->StartConnection(host_jid, authenticator.Pass());
60 sessions_[session->session_id_] = session.get(); 57 sessions_[session->session_id_] = session.get();
61 return session.Pass(); 58 return session.Pass();
62 } 59 }
63 60
64 void JingleSessionManager::Close() { 61 void JingleSessionManager::Close() {
65 DCHECK(CalledOnValidThread()); 62 DCHECK(CalledOnValidThread());
66 63
67 // Close() can be called only after all sessions are destroyed. 64 // Close() can be called only after all sessions are destroyed.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SendReply(stanza, JingleMessageReply::BAD_REQUEST); 97 SendReply(stanza, JingleMessageReply::BAD_REQUEST);
101 return true; 98 return true;
102 } 99 }
103 100
104 if (message.action == JingleMessage::SESSION_INITIATE) { 101 if (message.action == JingleMessage::SESSION_INITIATE) {
105 // Description must be present in session-initiate messages. 102 // Description must be present in session-initiate messages.
106 DCHECK(message.description.get()); 103 DCHECK(message.description.get());
107 104
108 SendReply(stanza, JingleMessageReply::NONE); 105 SendReply(stanza, JingleMessageReply::NONE);
109 106
110 // Notify |transport_factory_| that it may be used soon.
111 transport_factory_->PrepareTokens();
112
113 scoped_ptr<Authenticator> authenticator = 107 scoped_ptr<Authenticator> authenticator =
114 authenticator_factory_->CreateAuthenticator( 108 authenticator_factory_->CreateAuthenticator(
115 signal_strategy_->GetLocalJid(), message.from, 109 signal_strategy_->GetLocalJid(), message.from,
116 message.description->authenticator_message()); 110 message.description->authenticator_message());
117 111
118 JingleSession* session = new JingleSession(this); 112 JingleSession* session = new JingleSession(this);
119 session->InitializeIncomingConnection(message, authenticator.Pass()); 113 session->InitializeIncomingConnection(message, authenticator.Pass());
120 sessions_[session->session_id_] = session; 114 sessions_[session->session_id_] = session;
121 115
122 // Destroy the session if it was rejected due to incompatible protocol. 116 // Destroy the session if it was rejected due to incompatible protocol.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 signal_strategy_->SendStanza( 165 signal_strategy_->SendStanza(
172 JingleMessageReply(error).ToXml(original_stanza)); 166 JingleMessageReply(error).ToXml(original_stanza));
173 } 167 }
174 168
175 void JingleSessionManager::SessionDestroyed(JingleSession* session) { 169 void JingleSessionManager::SessionDestroyed(JingleSession* session) {
176 sessions_.erase(session->session_id_); 170 sessions_.erase(session->session_id_);
177 } 171 }
178 172
179 } // namespace protocol 173 } // namespace protocol
180 } // namespace remoting 174 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/ice_transport_session.cc ('k') | remoting/protocol/libjingle_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698