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

Side by Side Diff: remoting/protocol/jingle_session.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.h ('k') | remoting/protocol/jingle_session_manager.cc » ('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.h" 5 #include "remoting/protocol/jingle_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 JingleSession::JingleSession( 44 JingleSession::JingleSession(
45 JingleSessionManager* jingle_session_manager, 45 JingleSessionManager* jingle_session_manager,
46 const std::string& local_cert, 46 const std::string& local_cert,
47 crypto::RSAPrivateKey* local_private_key, 47 crypto::RSAPrivateKey* local_private_key,
48 const std::string& peer_public_key) 48 const std::string& peer_public_key)
49 : jingle_session_manager_(jingle_session_manager), 49 : jingle_session_manager_(jingle_session_manager),
50 local_cert_(local_cert), 50 local_cert_(local_cert),
51 state_(INITIALIZING), 51 state_(INITIALIZING),
52 error_(OK),
52 closing_(false), 53 closing_(false),
53 cricket_session_(NULL), 54 cricket_session_(NULL),
54 config_set_(false), 55 config_set_(false),
55 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 56 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
56 // TODO(hclam): Need a better way to clone a key. 57 // TODO(hclam): Need a better way to clone a key.
57 if (local_private_key) { 58 if (local_private_key) {
58 std::vector<uint8> key_bytes; 59 std::vector<uint8> key_bytes;
59 CHECK(local_private_key->ExportPrivateKey(&key_bytes)); 60 CHECK(local_private_key->ExportPrivateKey(&key_bytes));
60 local_private_key_.reset( 61 local_private_key_.reset(
61 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); 62 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 cricket_session_ = NULL; 126 cricket_session_ = NULL;
126 return session; 127 return session;
127 } 128 }
128 129
129 void JingleSession::SetStateChangeCallback(StateChangeCallback* callback) { 130 void JingleSession::SetStateChangeCallback(StateChangeCallback* callback) {
130 DCHECK(CalledOnValidThread()); 131 DCHECK(CalledOnValidThread());
131 DCHECK(callback); 132 DCHECK(callback);
132 state_change_callback_.reset(callback); 133 state_change_callback_.reset(callback);
133 } 134 }
134 135
136 Session::Error JingleSession::error() {
137 DCHECK(CalledOnValidThread());
138 return error_;
139 }
140
135 void JingleSession::CreateStreamChannel( 141 void JingleSession::CreateStreamChannel(
136 const std::string& name, const StreamChannelCallback& callback) { 142 const std::string& name, const StreamChannelCallback& callback) {
137 DCHECK(CalledOnValidThread()); 143 DCHECK(CalledOnValidThread());
138 144
139 AddChannelConnector( 145 AddChannelConnector(
140 name, new JingleStreamConnector(this, name, callback)); 146 name, new JingleStreamConnector(this, name, callback));
141 } 147 }
142 148
143 void JingleSession::CreateDatagramChannel( 149 void JingleSession::CreateDatagramChannel(
144 const std::string& name, const DatagramChannelCallback& callback) { 150 const std::string& name, const DatagramChannelCallback& callback) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 DCHECK_NE(state_, FAILED); 466 DCHECK_NE(state_, FAILED);
461 467
462 state_ = new_state; 468 state_ = new_state;
463 if (state_change_callback_.get()) 469 if (state_change_callback_.get())
464 state_change_callback_->Run(new_state); 470 state_change_callback_->Run(new_state);
465 } 471 }
466 } 472 }
467 473
468 } // namespace protocol 474 } // namespace protocol
469 } // namespace remoting 475 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698