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

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

Issue 8046018: Parse termination reason and propagate the error to the Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/pepper_session.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 (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/jingle_session_manager.h" 5 #include "remoting/protocol/jingle_session_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 jingle_session->set_candidate_config(content_description->config()->Clone()); 209 jingle_session->set_candidate_config(content_description->config()->Clone());
210 jingle_session->set_initiator_token(content_description->auth_token()); 210 jingle_session->set_initiator_token(content_description->auth_token());
211 211
212 // Always reject connection if there is no callback. 212 // Always reject connection if there is no callback.
213 IncomingSessionResponse response = protocol::SessionManager::DECLINE; 213 IncomingSessionResponse response = protocol::SessionManager::DECLINE;
214 214
215 // Use the callback to generate a response. 215 // Use the callback to generate a response.
216 listener_->OnIncomingSession(jingle_session, &response); 216 listener_->OnIncomingSession(jingle_session, &response);
217 217
218 switch (response) { 218 switch (response) {
219 case protocol::SessionManager::ACCEPT: { 219 case SessionManager::ACCEPT: {
220 // Connection must be configured by the callback. 220 // Connection must be configured by the callback.
221 CandidateSessionConfig* candidate_config = 221 CandidateSessionConfig* candidate_config =
222 CandidateSessionConfig::CreateFrom(jingle_session->config()); 222 CandidateSessionConfig::CreateFrom(jingle_session->config());
223 cricket_session->Accept( 223 cricket_session->Accept(
224 CreateHostSessionDescription(candidate_config, 224 CreateHostSessionDescription(candidate_config,
225 jingle_session->local_certificate())); 225 jingle_session->local_certificate()));
226 break; 226 break;
227 } 227 }
228 228
229 case protocol::SessionManager::INCOMPATIBLE: { 229 case SessionManager::INCOMPATIBLE: {
230 cricket_session->Reject(cricket::STR_TERMINATE_INCOMPATIBLE_PARAMETERS); 230 cricket_session->TerminateWithReason(
231 cricket::STR_TERMINATE_INCOMPATIBLE_PARAMETERS);
231 return false; 232 return false;
232 } 233 }
233 234
234 case protocol::SessionManager::DECLINE: { 235 case SessionManager::DECLINE: {
235 cricket_session->Reject(cricket::STR_TERMINATE_DECLINE); 236 cricket_session->TerminateWithReason(cricket::STR_TERMINATE_DECLINE);
236 return false; 237 return false;
237 } 238 }
238 239
239 default: { 240 default: {
240 NOTREACHED(); 241 NOTREACHED();
241 } 242 }
242 } 243 }
243 244
244 return true; 245 return true;
245 } 246 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 const std::string& certificate) { 319 const std::string& certificate) {
319 cricket::SessionDescription* desc = new cricket::SessionDescription(); 320 cricket::SessionDescription* desc = new cricket::SessionDescription();
320 desc->AddContent( 321 desc->AddContent(
321 ContentDescription::kChromotingContentName, kChromotingXmlNamespace, 322 ContentDescription::kChromotingContentName, kChromotingXmlNamespace,
322 new ContentDescription(config, "", certificate)); 323 new ContentDescription(config, "", certificate));
323 return desc; 324 return desc;
324 } 325 }
325 326
326 } // namespace protocol 327 } // namespace protocol
327 } // namespace remoting 328 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/pepper_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698