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

Unified Diff: remoting/webapp/crd/js/client_session.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: Smaller diff. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/client_session.js
diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js
index dc2a2a9ccf96949f794959a288869591d9753092..a08a5492e65b8a19421ce25c4bbdcff96c205bcc 100644
--- a/remoting/webapp/crd/js/client_session.js
+++ b/remoting/webapp/crd/js/client_session.js
@@ -62,7 +62,7 @@ remoting.ClientSession = function(host, signalStrategy, container, accessCode,
/** @private */
this.state_ = remoting.ClientSession.State.CREATED;
- /** @private */
+ /** @private {!remoting.Error} */
this.error_ = remoting.Error.NONE;
/** @private */
@@ -287,12 +287,12 @@ remoting.ClientSession.prototype.createPluginAndConnect =
};
/**
- * @param {remoting.Error} error
+ * @param {!remoting.Error} error
* @param {remoting.ClientPlugin} plugin
*/
remoting.ClientSession.prototype.onPluginInitialized_ = function(
error, plugin) {
- if (error != remoting.Error.NONE) {
+ if (error.tag != remoting.Error.Tag.NONE) {
this.resetWithError_(error);
}
@@ -314,7 +314,7 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(
};
/**
- * @param {remoting.Error} error
+ * @param {!remoting.Error} error
*/
remoting.ClientSession.prototype.resetWithError_ = function(error) {
this.signalStrategy_.setIncomingStanzaCallback(null);
@@ -340,12 +340,12 @@ remoting.ClientSession.prototype.removePlugin = function() {
* raise a |stateChanged| event in response to it. The caller should then call
* |cleanup| to remove and destroy the <embed> element.
*
- * @param {remoting.Error} error The reason for the disconnection. Use
+ * @param {!remoting.Error} error The reason for the disconnection. Use
* remoting.Error.NONE if there is no error.
* @return {void} Nothing.
*/
remoting.ClientSession.prototype.disconnect = function(error) {
- var state = (error == remoting.Error.NONE) ?
+ var state = (error.tag == remoting.Error.Tag.NONE) ?
remoting.ClientSession.State.CLOSED :
remoting.ClientSession.State.FAILED;
@@ -386,7 +386,7 @@ remoting.ClientSession.prototype.getState = function() {
};
/**
- * @return {remoting.Error} The current error code.
+ * @return {!remoting.Error} The current error code.
*/
remoting.ClientSession.prototype.getError = function() {
return this.error_;
@@ -631,7 +631,7 @@ remoting.ClientSession.prototype.setState_ = function(newState) {
if (this.state_ == remoting.ClientSession.State.CLOSED) {
state = remoting.ClientSession.State.CONNECTION_CANCELED;
} else if (this.state_ == remoting.ClientSession.State.FAILED &&
- this.error_ == remoting.Error.HOST_IS_OFFLINE &&
+ this.error_.tag == remoting.Error.Tag.HOST_IS_OFFLINE &&
!this.logHostOfflineErrors_) {
// The application requested host-offline errors to be suppressed, for
// example, because this connection attempt is using a cached host JID.
@@ -775,7 +775,7 @@ remoting.ClientSession.prototype.sendGoogleDriveAccessToken_ = function() {
var sendToken = function(token) {
remoting.clientSession.sendClientMessage('accessToken', token);
};
- /** @param {remoting.Error} error */
+ /** @param {!remoting.Error} error */
var sendError = function(error) {
console.log('Failed to refresh access token: ' + error);
};

Powered by Google App Engine
This is Rietveld 408576698