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

Side by Side Diff: remoting/webapp/base/js/host_options.js

Issue 2621403004: Create proper object types when loading host cache. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/base/js/host.js ('k') | remoting/webapp/crd/js/host_list.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/host.js ('k') | remoting/webapp/crd/js/host_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698