| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 remoting.wcsSandbox.setOnIq(this.onIncomingStanza_.bind(this)); | 55 remoting.wcsSandbox.setOnIq(this.onIncomingStanza_.bind(this)); |
| 56 remoting.wcsSandbox.connect(this.onWcsConnected_.bind(this), | 56 remoting.wcsSandbox.connect(this.onWcsConnected_.bind(this), |
| 57 this.onError_.bind(this)); | 57 this.onError_.bind(this)); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 /** @return {remoting.SignalStrategy.State} Current state */ | 60 /** @return {remoting.SignalStrategy.State} Current state */ |
| 61 remoting.WcsAdapter.prototype.getState = function() { | 61 remoting.WcsAdapter.prototype.getState = function() { |
| 62 return this.state_; | 62 return this.state_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 /** @return {remoting.Error} Error when in FAILED state. */ | 65 /** @return {!remoting.Error} Error when in FAILED state. */ |
| 66 remoting.WcsAdapter.prototype.getError = function() { | 66 remoting.WcsAdapter.prototype.getError = function() { |
| 67 return this.error_; | 67 return this.error_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 /** @return {string} Current JID when in CONNECTED state. */ | 70 /** @return {string} Current JID when in CONNECTED state. */ |
| 71 remoting.WcsAdapter.prototype.getJid = function() { | 71 remoting.WcsAdapter.prototype.getJid = function() { |
| 72 return this.jid_; | 72 return this.jid_; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */ | 75 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 } catch (err) { | 131 } catch (err) { |
| 132 // Pass message as is when it is malformed. | 132 // Pass message as is when it is malformed. |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (this.onIncomingStanzaCallback_) { | 135 if (this.onIncomingStanzaCallback_) { |
| 136 this.onIncomingStanzaCallback_(parsed); | 136 this.onIncomingStanzaCallback_(parsed); |
| 137 } | 137 } |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 /** @param {remoting.Error} error */ | 140 /** @param {!remoting.Error} error */ |
| 141 remoting.WcsAdapter.prototype.onError_ = function(error) { | 141 remoting.WcsAdapter.prototype.onError_ = function(error) { |
| 142 this.error_ = error; | 142 this.error_ = error; |
| 143 this.setState_(remoting.SignalStrategy.State.FAILED); | 143 this.setState_(remoting.SignalStrategy.State.FAILED); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {remoting.SignalStrategy.State} newState | 147 * @param {remoting.SignalStrategy.State} newState |
| 148 * @private | 148 * @private |
| 149 */ | 149 */ |
| 150 remoting.WcsAdapter.prototype.setState_ = function(newState) { | 150 remoting.WcsAdapter.prototype.setState_ = function(newState) { |
| 151 if (this.state_ != newState) { | 151 if (this.state_ != newState) { |
| 152 this.state_ = newState; | 152 this.state_ = newState; |
| 153 this.onStateChangedCallback_(this.state_); | 153 this.onStateChangedCallback_(this.state_); |
| 154 } | 154 } |
| 155 }; | 155 }; |
| OLD | NEW |