Chromium Code Reviews| Index: remoting/webapp/client_session.js |
| diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js |
| index da8051e452e7e987b4efee4a77d271c2de0c6f40..9adc6336764360250a4e60edb8e69800d7b418dc 100644 |
| --- a/remoting/webapp/client_session.js |
| +++ b/remoting/webapp/client_session.js |
| @@ -94,6 +94,13 @@ remoting.ClientSession = function(hostJid, hostPublicKey, sharedSecret, |
| this.fullScreen_.addEventListener('click', this.callToggleFullScreen_, false); |
| /** @type {number?} @private */ |
| this.bumpScrollTimer_ = null; |
| + /** |
| + * Allow error reporting to be suppressed in situations where it would not |
| + * be useful, for example, when the device is offline. |
| + * |
| + * @type {boolean} @private |
| + */ |
| + this.logErrors_ = true; |
| }; |
| // Note that the positive values in both of these enums are copied directly |
| @@ -521,8 +528,15 @@ remoting.ClientSession.prototype.setState_ = function(newState) { |
| if (this.onStateChange) { |
| this.onStateChange(oldState, newState); |
| } |
| - this.logToServer.logClientSessionStateChange(this.state, this.error, |
| - this.mode); |
| + // If connection errors are being suppressed from the logs, translate |
| + // FAILED to CLOSED here. This ensures that the duration is still logged. |
| + var state = this.state; |
| + if (this.state == remoting.ClientSession.State.FAILED && |
| + !this.logErrors_) { |
| + console.log('Suppressing error.'); |
| + state = remoting.ClientSession.State.CLOSED; |
| + } |
| + this.logToServer.logClientSessionStateChange(state, this.error, this.mode); |
| }; |
| /** |
| @@ -649,6 +663,17 @@ remoting.ClientSession.prototype.logStatistics = function(stats) { |
| }; |
| /** |
| + * Enable or disable logging of connection errors. For example, if attempting |
| + * a connection using a cached JID, errors should not be logged because the |
| + * JID will be refreshed and the connectioned retried. |
|
simonmorris
2012/08/03 21:48:49
connectioned -> connection
Jamie
2012/08/03 23:15:14
Done.
|
| + * |
| + * @param {boolean} enable True to log errors; false to suppress them. |
| + */ |
| +remoting.ClientSession.prototype.logErrors = function(enable) { |
| + this.logErrors_ = enable; |
| +}; |
| + |
| +/** |
| * Toggles between full-screen and windowed mode. |
| * @return {void} Nothing. |
| * @private |