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

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

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Requested changes. Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** 10 /**
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 */ 120 */
121 remoting.XmppConnection.prototype.sendConnectionSetupResults = 121 remoting.XmppConnection.prototype.sendConnectionSetupResults =
122 function(logToServer) { 122 function(logToServer) {
123 }; 123 };
124 124
125 /** @return {remoting.SignalStrategy.State} Current state */ 125 /** @return {remoting.SignalStrategy.State} Current state */
126 remoting.XmppConnection.prototype.getState = function() { 126 remoting.XmppConnection.prototype.getState = function() {
127 return this.state_; 127 return this.state_;
128 }; 128 };
129 129
130 /** @return {remoting.Error} Error when in FAILED state. */ 130 /** @return {!remoting.Error} Error when in FAILED state. */
131 remoting.XmppConnection.prototype.getError = function() { 131 remoting.XmppConnection.prototype.getError = function() {
132 return this.error_; 132 return this.error_;
133 }; 133 };
134 134
135 /** @return {string} Current JID when in CONNECTED state. */ 135 /** @return {string} Current JID when in CONNECTED state. */
136 remoting.XmppConnection.prototype.getJid = function() { 136 remoting.XmppConnection.prototype.getJid = function() {
137 return this.jid_; 137 return this.jid_;
138 }; 138 };
139 139
140 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */ 140 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 /** 355 /**
356 * @param {string} text 356 * @param {string} text
357 * @private 357 * @private
358 */ 358 */
359 remoting.XmppConnection.prototype.onParserError_ = function(text) { 359 remoting.XmppConnection.prototype.onParserError_ = function(text) {
360 this.onError_(remoting.Error.UNEXPECTED, text); 360 this.onError_(remoting.Error.UNEXPECTED, text);
361 } 361 }
362 362
363 /** 363 /**
364 * @param {remoting.Error} error 364 * @param {!remoting.Error} error
365 * @param {string} text 365 * @param {string} text
366 * @private 366 * @private
367 */ 367 */
368 remoting.XmppConnection.prototype.onError_ = function(error, text) { 368 remoting.XmppConnection.prototype.onError_ = function(error, text) {
369 console.error(text); 369 console.error(text);
370 this.error_ = error; 370 this.error_ = error;
371 this.closeSocket_(); 371 this.closeSocket_();
372 this.setState_(remoting.SignalStrategy.State.FAILED); 372 this.setState_(remoting.SignalStrategy.State.FAILED);
373 }; 373 };
374 374
(...skipping 10 matching lines...) Expand all
385 /** 385 /**
386 * @param {remoting.SignalStrategy.State} newState 386 * @param {remoting.SignalStrategy.State} newState
387 * @private 387 * @private
388 */ 388 */
389 remoting.XmppConnection.prototype.setState_ = function(newState) { 389 remoting.XmppConnection.prototype.setState_ = function(newState) {
390 if (this.state_ != newState) { 390 if (this.state_ != newState) {
391 this.state_ = newState; 391 this.state_ = newState;
392 this.onStateChangedCallback_(this.state_); 392 this.onStateChangedCallback_(this.state_);
393 } 393 }
394 }; 394 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698