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

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: 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 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 0572d95668c7875153f9742f85dbb13047dd3cf1..33ba35fb30a6d50db8eab8bc87c028d83b2735e5 100644
--- a/remoting/webapp/crd/js/client_session.js
+++ b/remoting/webapp/crd/js/client_session.js
@@ -49,7 +49,7 @@ remoting.ClientSession = function(host, signalStrategy, credentialsProvider,
/** @private */
this.state_ = remoting.ClientSession.State.CREATED;
- /** @private */
+ /** @private {!remoting.Error} */
this.error_ = remoting.Error.NONE;
/** @private */
@@ -264,12 +264,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);
}
@@ -292,7 +292,7 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(
};
/**
- * @param {remoting.Error} error
+ * @param {!remoting.Error} error
*/
remoting.ClientSession.prototype.resetWithError_ = function(error) {
this.signalStrategy_.setIncomingStanzaCallback(null);
@@ -319,12 +319,12 @@ remoting.ClientSession.prototype.removePlugin = function() {
* raise a |stateChanged| event in response to it. The caller should then call
* dispose() 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;
@@ -365,7 +365,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_;
@@ -552,7 +552,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.
@@ -696,7 +696,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