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

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

Issue 1070223003: [Webapp Refactor] Remove remoting.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 8 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
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/crd/js/feedback.js » ('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) 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class handling creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 /** @private */ 50 /** @private */
51 this.hasReceivedFrame_ = false; 51 this.hasReceivedFrame_ = false;
52 this.logToServer = new remoting.LogToServer(signalStrategy); 52 this.logToServer = new remoting.LogToServer(signalStrategy);
53 53
54 /** @private */ 54 /** @private */
55 this.signalStrategy_ = signalStrategy; 55 this.signalStrategy_ = signalStrategy;
56 base.debug.assert(this.signalStrategy_.getState() == 56 base.debug.assert(this.signalStrategy_.getState() ==
57 remoting.SignalStrategy.State.CONNECTED); 57 remoting.SignalStrategy.State.CONNECTED);
58 this.signalStrategy_.setIncomingStanzaCallback( 58 this.signalStrategy_.setIncomingStanzaCallback(
59 this.onIncomingMessage_.bind(this)); 59 this.onIncomingMessage_.bind(this));
60 remoting.formatIq.setJids(this.signalStrategy_.getJid(), host.jabberId); 60
61 /** @private */
62 this.iqFormatter_ =
63 new remoting.FormatIq(this.signalStrategy_.getJid(), host.jabberId);
61 64
62 /** 65 /**
63 * Allow host-offline error reporting to be suppressed in situations where it 66 * Allow host-offline error reporting to be suppressed in situations where it
64 * would not be useful, for example, when using a cached host JID. 67 * would not be useful, for example, when using a cached host JID.
65 * 68 *
66 * @type {boolean} @private 69 * @type {boolean} @private
67 */ 70 */
68 this.logHostOfflineErrors_ = true; 71 this.logHostOfflineErrors_ = true;
69 72
70 /** @private {remoting.ClientPlugin} */ 73 /** @private {remoting.ClientPlugin} */
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 var parser = new DOMParser(); 362 var parser = new DOMParser();
360 var iqNode = parser.parseFromString(message, 'text/xml').firstChild; 363 var iqNode = parser.parseFromString(message, 'text/xml').firstChild;
361 var jingleNode = iqNode.firstChild; 364 var jingleNode = iqNode.firstChild;
362 if (jingleNode) { 365 if (jingleNode) {
363 var action = jingleNode.getAttribute('action'); 366 var action = jingleNode.getAttribute('action');
364 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') { 367 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') {
365 this.sessionId_ = jingleNode.getAttribute('sid'); 368 this.sessionId_ = jingleNode.getAttribute('sid');
366 } 369 }
367 } 370 }
368 371
369 console.log(remoting.timestamp(), remoting.formatIq.prettifySendIq(message)); 372 console.log(base.timestamp() + this.iqFormatter_.prettifySendIq(message));
370 if (this.signalStrategy_.getState() != 373 if (this.signalStrategy_.getState() !=
371 remoting.SignalStrategy.State.CONNECTED) { 374 remoting.SignalStrategy.State.CONNECTED) {
372 console.log("Message above is dropped because signaling is not connected."); 375 console.log("Message above is dropped because signaling is not connected.");
373 return; 376 return;
374 } 377 }
375 378
376 this.signalStrategy_.sendMessage(message); 379 this.signalStrategy_.sendMessage(message);
377 }; 380 };
378 381
379 /** 382 /**
(...skipping 12 matching lines...) Expand all
392 395
393 /** 396 /**
394 * @param {Element} message 397 * @param {Element} message
395 * @private 398 * @private
396 */ 399 */
397 remoting.ClientSession.prototype.onIncomingMessage_ = function(message) { 400 remoting.ClientSession.prototype.onIncomingMessage_ = function(message) {
398 if (!this.plugin_) { 401 if (!this.plugin_) {
399 return; 402 return;
400 } 403 }
401 var formatted = new XMLSerializer().serializeToString(message); 404 var formatted = new XMLSerializer().serializeToString(message);
402 console.log(remoting.timestamp(), 405 console.log(base.timestamp() +
403 remoting.formatIq.prettifyReceiveIq(formatted)); 406 this.iqFormatter_.prettifyReceiveIq(formatted));
404 this.plugin_.onIncomingIq(formatted); 407 this.plugin_.onIncomingIq(formatted);
405 }; 408 };
406 409
407 /** 410 /**
408 * Callback that the plugin invokes to indicate that the connection 411 * Callback that the plugin invokes to indicate that the connection
409 * status has changed. 412 * status has changed.
410 * 413 *
411 * @param {remoting.ClientSession.State} status The plugin's status. 414 * @param {remoting.ClientSession.State} status The plugin's status.
412 * @param {remoting.ClientSession.ConnectionError} error The plugin's error 415 * @param {remoting.ClientSession.ConnectionError} error The plugin's error
413 * state, if any. 416 * state, if any.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 * For example, if attempting a connection using a cached JID, host-offline 567 * For example, if attempting a connection using a cached JID, host-offline
565 * errors should not be logged because the JID will be refreshed and the 568 * errors should not be logged because the JID will be refreshed and the
566 * connection retried. 569 * connection retried.
567 * 570 *
568 * @param {boolean} enable True to log host-offline errors; false to suppress. 571 * @param {boolean} enable True to log host-offline errors; false to suppress.
569 */ 572 */
570 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { 573 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) {
571 this.logHostOfflineErrors_ = enable; 574 this.logHostOfflineErrors_ = enable;
572 }; 575 };
573 576
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/crd/js/feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698