OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 handling saving and restoring of per-host options. | 7 * Class handling saving and restoring of per-host options. |
8 */ | 8 */ |
9 | 9 |
10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
(...skipping 19 matching lines...) Expand all Loading... |
30 /** @private {?boolean} */ | 30 /** @private {?boolean} */ |
31 this.resizeToClient = null; | 31 this.resizeToClient = null; |
32 /** @private {?number} */ | 32 /** @private {?number} */ |
33 this.desktopScale = null; | 33 this.desktopScale = null; |
34 /** @private {?remoting.PairingInfo} */ | 34 /** @private {?remoting.PairingInfo} */ |
35 this.pairingInfo = null; | 35 this.pairingInfo = null; |
36 /** @private {Object} */ | 36 /** @private {Object} */ |
37 this.remapKeys = null; | 37 this.remapKeys = null; |
38 }; | 38 }; |
39 | 39 |
40 /** @return {boolean} True if the remote desktop should be reduced in size to | 40 /** |
| 41 * Create a typed HostOptions instance from an untyped Object. |
| 42 * |
| 43 * @param {Object} object |
| 44 * @param {string} hostId |
| 45 * @return {remoting.HostOptions} |
| 46 */ |
| 47 remoting.HostOptions.fromObject = function(object, hostId) { |
| 48 var result = new remoting.HostOptions(hostId); |
| 49 try { |
| 50 result.shrinkToFit = base.assertBoolean(object.shrinkToFit); |
| 51 } catch (e) {} |
| 52 try { |
| 53 result.resizeToClient = base.assertBoolean(object.resizeToClient); |
| 54 } catch (e) {} |
| 55 try { |
| 56 result.desktopScale = base.assertNumber(object.desktopScale); |
| 57 } catch (e) {} |
| 58 try { |
| 59 pairingInfo = base.assertObject(object.pairingInfo); |
| 60 } catch (e) {} |
| 61 try { |
| 62 remapKeys = base.assertObject(object.remapKeys); |
| 63 } catch (e) {} |
| 64 return result; |
| 65 }; |
| 66 |
| 67 /** @return {boolean} True if the remote desktop should be reduced in size to |
41 * fit a smaller client window; false if scroll-bars or bump-scrolling | 68 * fit a smaller client window; false if scroll-bars or bump-scrolling |
42 * should be used instead. | 69 * should be used instead. |
43 */ | 70 */ |
44 remoting.HostOptions.prototype.getShrinkToFit = function() { | 71 remoting.HostOptions.prototype.getShrinkToFit = function() { |
45 return (this.shrinkToFit == null) ? true : this.shrinkToFit; | 72 return (this.shrinkToFit == null) ? true : this.shrinkToFit; |
46 }; | 73 }; |
47 | 74 |
48 /** @param {boolean} shrinkToFit */ | 75 /** @param {boolean} shrinkToFit */ |
49 remoting.HostOptions.prototype.setShrinkToFit = function(shrinkToFit) { | 76 remoting.HostOptions.prototype.setShrinkToFit = function(shrinkToFit) { |
50 this.shrinkToFit = shrinkToFit; | 77 this.shrinkToFit = shrinkToFit; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 241 } |
215 result[fromKey] = toKey; | 242 result[fromKey] = toKey; |
216 } | 243 } |
217 return result; | 244 return result; |
218 }; | 245 }; |
219 | 246 |
220 /** @type {string} @private */ | 247 /** @type {string} @private */ |
221 remoting.HostOptions.KEY_ = 'remoting-host-options'; | 248 remoting.HostOptions.KEY_ = 'remoting-host-options'; |
222 | 249 |
223 })(); | 250 })(); |
OLD | NEW |