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

Side by Side Diff: remoting/webapp/me2mom/client_session.js

Issue 7578009: Don't examine jingleNode unless it's non-null. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « no previous file | no next file » | 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Session class that handles creation and teardown of a remoting session. 7 * Session class that handles creation and teardown of a remoting session.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does the 9 * This abstracts a <embed> element and controls the plugin which does the
10 * actual remoting work. There should be no UI code inside this class. It 10 * actual remoting work. There should be no UI code inside this class. It
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 remoting.debug.log('Sending Iq: ' + msg); 198 remoting.debug.log('Sending Iq: ' + msg);
199 199
200 // Extract the top level fields of the Iq packet. 200 // Extract the top level fields of the Iq packet.
201 // TODO(ajwong): Can the plugin just return these fields broken out. 201 // TODO(ajwong): Can the plugin just return these fields broken out.
202 var parser = new DOMParser(); 202 var parser = new DOMParser();
203 var iqNode = parser.parseFromString(msg, 'text/xml').firstChild; 203 var iqNode = parser.parseFromString(msg, 'text/xml').firstChild;
204 var jingleNode = iqNode.firstChild; 204 var jingleNode = iqNode.firstChild;
205 var serializer = new XMLSerializer(); 205 var serializer = new XMLSerializer();
206 var parameters = { 206 var parameters = {
207 'to': iqNode.getAttribute('to') || '', 207 'to': iqNode.getAttribute('to') || '',
208 'payload_xml': serializer.serializeToString(jingleNode), 208 'payload_xml': serializer.serializeToString(jingleNode),
Sergey Ulanov 2011/08/04 20:46:19 Does this serialize null to an empty string?
Jamie 2011/08/04 20:46:57 Yes.
209 'id': iqNode.getAttribute('id') || '1', 209 'id': iqNode.getAttribute('id') || '1',
210 'type': iqNode.getAttribute('type'), 210 'type': iqNode.getAttribute('type'),
211 'host_jid': this.hostJid 211 'host_jid': this.hostJid
212 }; 212 };
213 213
214 this.sendIqWithParameters_(parameters); 214 this.sendIqWithParameters_(parameters);
215 215
216 var action = jingleNode.getAttribute('action'); 216 if (jingleNode) {
217 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') { 217 var action = jingleNode.getAttribute('action');
218 // The session id is needed in order to close the session later. 218 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') {
219 this.sessionId = jingleNode.getAttribute('sid'); 219 // The session id is needed in order to close the session later.
220 this.sessionId = jingleNode.getAttribute('sid');
221 }
220 } 222 }
221 }; 223 };
222 224
223 /** 225 /**
224 * Sends an IQ stanza via the http xmpp proxy. 226 * Sends an IQ stanza via the http xmpp proxy.
225 * 227 *
226 * @param {(string|Object.<string>)} paramters Parameters to include. 228 * @param {(string|Object.<string>)} paramters Parameters to include.
227 * @return {void} Nothing. 229 * @return {void} Nothing.
228 */ 230 */
229 remoting.ClientSession.prototype.sendIqWithParameters_ = function(parameters) { 231 remoting.ClientSession.prototype.sendIqWithParameters_ = function(parameters) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 'video_bandwidth': this.plugin.videoBandwidth, 416 'video_bandwidth': this.plugin.videoBandwidth,
415 'capture_latency': this.plugin.videoCaptureLatency, 417 'capture_latency': this.plugin.videoCaptureLatency,
416 'encode_latency': this.plugin.videoEncodeLatency, 418 'encode_latency': this.plugin.videoEncodeLatency,
417 'decode_latency': this.plugin.videoDecodeLatency, 419 'decode_latency': this.plugin.videoDecodeLatency,
418 'render_latency': this.plugin.videoRenderLatency, 420 'render_latency': this.plugin.videoRenderLatency,
419 'roundtrip_latency': this.plugin.roundTripLatency 421 'roundtrip_latency': this.plugin.roundTripLatency
420 }; 422 };
421 }; 423 };
422 424
423 }()); 425 }());
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698