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

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

Issue 1530523002: More cleanups in JingleSessionManager interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@transport_context
Patch Set: Created 5 years 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
« no previous file with comments | « remoting/protocol/connection_to_host_impl.h ('k') | remoting/protocol/jingle_session_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_impl.h" 5 #include "remoting/protocol/connection_to_host_impl.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 event_callback_ = event_callback; 87 event_callback_ = event_callback;
88 authenticator_ = authenticator.Pass(); 88 authenticator_ = authenticator.Pass();
89 89
90 // Save jid of the host. The actual connection is created later after 90 // Save jid of the host. The actual connection is created later after
91 // |signal_strategy_| is connected. 91 // |signal_strategy_| is connected.
92 host_jid_ = host_jid; 92 host_jid_ = host_jid;
93 93
94 signal_strategy_->AddListener(this); 94 signal_strategy_->AddListener(this);
95 95
96 session_manager_.reset(new JingleSessionManager( 96 session_manager_.reset(new JingleSessionManager(
97 make_scoped_ptr(new IceTransportFactory(transport_context)))); 97 make_scoped_ptr(new IceTransportFactory(transport_context)),
98 signal_strategy));
98 session_manager_->set_protocol_config(candidate_config_->Clone()); 99 session_manager_->set_protocol_config(candidate_config_->Clone());
99 session_manager_->Init(signal_strategy_, this);
100 100
101 SetState(CONNECTING, OK); 101 SetState(CONNECTING, OK);
102 102
103 switch (signal_strategy_->GetState()) { 103 switch (signal_strategy_->GetState()) {
104 case SignalStrategy::CONNECTING: 104 case SignalStrategy::CONNECTING:
105 // Nothing to do here. Just need to wait until |signal_strategy_| becomes 105 // Nothing to do here. Just need to wait until |signal_strategy_| becomes
106 // connected. 106 // connected.
107 break; 107 break;
108 case SignalStrategy::CONNECTED: 108 case SignalStrategy::CONNECTED:
109 StartSession(); 109 StartSession();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 VLOG(1) << "Connection closed."; 181 VLOG(1) << "Connection closed.";
182 CloseOnError(SIGNALING_ERROR); 182 CloseOnError(SIGNALING_ERROR);
183 } 183 }
184 } 184 }
185 185
186 bool ConnectionToHostImpl::OnSignalStrategyIncomingStanza( 186 bool ConnectionToHostImpl::OnSignalStrategyIncomingStanza(
187 const buzz::XmlElement* stanza) { 187 const buzz::XmlElement* stanza) {
188 return false; 188 return false;
189 } 189 }
190 190
191 void ConnectionToHostImpl::OnIncomingSession(
192 Session* session,
193 SessionManager::IncomingSessionResponse* response) {
194 DCHECK(CalledOnValidThread());
195 // Client always rejects incoming sessions.
196 *response = SessionManager::DECLINE;
197 }
198
199 void ConnectionToHostImpl::OnSessionStateChange(Session::State state) { 191 void ConnectionToHostImpl::OnSessionStateChange(Session::State state) {
200 DCHECK(CalledOnValidThread()); 192 DCHECK(CalledOnValidThread());
201 DCHECK(event_callback_); 193 DCHECK(event_callback_);
202 194
203 switch (state) { 195 switch (state) {
204 case Session::INITIALIZING: 196 case Session::INITIALIZING:
205 case Session::CONNECTING: 197 case Session::CONNECTING:
206 case Session::ACCEPTING: 198 case Session::ACCEPTING:
207 case Session::ACCEPTED: 199 case Session::ACCEPTED:
208 case Session::AUTHENTICATING: 200 case Session::AUTHENTICATING:
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 318
327 if (state != state_) { 319 if (state != state_) {
328 state_ = state; 320 state_ = state;
329 error_ = error; 321 error_ = error;
330 event_callback_->OnConnectionState(state_, error_); 322 event_callback_->OnConnectionState(state_, error_);
331 } 323 }
332 } 324 }
333 325
334 } // namespace protocol 326 } // namespace protocol
335 } // namespace remoting 327 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host_impl.h ('k') | remoting/protocol/jingle_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698