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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/host_options.js
diff --git a/remoting/webapp/base/js/host_options.js b/remoting/webapp/base/js/host_options.js
index e70e4609b1981147eac6f7399b4c1f2a625f4252..96454f09536a9912d0396ef7fad7dffa06e64f5c 100644
--- a/remoting/webapp/base/js/host_options.js
+++ b/remoting/webapp/base/js/host_options.js
@@ -37,7 +37,34 @@ remoting.HostOptions = function (hostId) {
this.remapKeys = null;
};
-/** @return {boolean} True if the remote desktop should be reduced in size to
+/**
+ * Create a typed HostOptions instance from an untyped Object.
+ *
+ * @param {Object} object
+ * @param {string} hostId
+ * @return {remoting.HostOptions}
+ */
+remoting.HostOptions.fromObject = function(object, hostId) {
+ var result = new remoting.HostOptions(hostId);
+ try {
+ result.shrinkToFit = base.assertBoolean(object.shrinkToFit);
+ } catch (e) {}
+ try {
+ result.resizeToClient = base.assertBoolean(object.resizeToClient);
+ } catch (e) {}
+ try {
+ result.desktopScale = base.assertNumber(object.desktopScale);
+ } catch (e) {}
+ try {
+ pairingInfo = base.assertObject(object.pairingInfo);
+ } catch (e) {}
+ try {
+ remapKeys = base.assertObject(object.remapKeys);
+ } catch (e) {}
+ return result;
+};
+
+ /** @return {boolean} True if the remote desktop should be reduced in size to
* fit a smaller client window; false if scroll-bars or bump-scrolling
* should be used instead.
*/
« 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