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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class to communicate with the It2me Host component via Native Messaging. | 7 * Class to communicate with the It2me Host component via Native Messaging. |
8 */ | 8 */ |
9 | 9 |
10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 break; | 280 break; |
281 | 281 |
282 case 'natPolicyChanged': | 282 case 'natPolicyChanged': |
283 if (this.onNatPolicyChanged_) { | 283 if (this.onNatPolicyChanged_) { |
284 var natTraversalEnabled = | 284 var natTraversalEnabled = |
285 base.getBooleanAttr(message, 'natTraversalEnabled'); | 285 base.getBooleanAttr(message, 'natTraversalEnabled'); |
286 this.onNatPolicyChanged_(natTraversalEnabled); | 286 this.onNatPolicyChanged_(natTraversalEnabled); |
287 } | 287 } |
288 break; | 288 break; |
289 | 289 |
| 290 case 'policyError': |
| 291 if (this.onError_) { |
| 292 this.onError_(new remoting.Error(remoting.Error.Tag.POLICY_ERROR)); |
| 293 } |
| 294 break; |
| 295 |
290 case 'error': | 296 case 'error': |
291 console.error(base.getStringAttr(message, 'description')); | 297 console.error(base.getStringAttr(message, 'description')); |
292 if (this.onError_) { | 298 if (this.onError_) { |
293 this.onError_(remoting.Error.unexpected()); | 299 this.onError_(remoting.Error.unexpected()); |
294 } | 300 } |
295 break; | 301 break; |
296 | 302 |
297 default: | 303 default: |
298 throw 'Unexpected native message: ' + message; | 304 throw 'Unexpected native message: ' + message; |
299 } | 305 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 chrome.runtime.lastError.message); | 342 chrome.runtime.lastError.message); |
337 this.onInitializationFailed_(); | 343 this.onInitializationFailed_(); |
338 } else { | 344 } else { |
339 console.error('Native Messaging port disconnected.'); | 345 console.error('Native Messaging port disconnected.'); |
340 this.port_ = null; | 346 this.port_ = null; |
341 this.onError_(remoting.Error.unexpected()); | 347 this.onError_(remoting.Error.unexpected()); |
342 } | 348 } |
343 }; | 349 }; |
344 | 350 |
345 })(); | 351 })(); |
OLD | NEW |