| Index: remoting/webapp/base/js/host.js
|
| diff --git a/remoting/webapp/base/js/host.js b/remoting/webapp/base/js/host.js
|
| index aed63da3bde87b7912024e54f07cc94553f52f5a..1a93bec65166973caf150ff551e3f72948098009 100644
|
| --- a/remoting/webapp/base/js/host.js
|
| +++ b/remoting/webapp/base/js/host.js
|
| @@ -44,92 +44,8 @@ remoting.Host = function(hostId) {
|
| this.updatedTime = '';
|
| /** @type {string} */
|
| this.hostOfflineReason = '';
|
| - /** @type {remoting.Host.Options} */
|
| - this.options = new remoting.Host.Options(hostId);
|
| -};
|
| -
|
| -/**
|
| - * @constructor
|
| - * @param {!string} hostId
|
| - * @struct
|
| - */
|
| -remoting.Host.Options = function(hostId) {
|
| - /** @private @const */
|
| - this.hostId_ = hostId;
|
| - /** @type {boolean} */
|
| - this.shrinkToFit = true;
|
| - /** @type {boolean} */
|
| - this.resizeToClient = true;
|
| - /** @type {!Object} */
|
| - this.remapKeys = {};
|
| - /** @type {number} */
|
| - this.desktopScale = 1;
|
| - /** @type {remoting.PairingInfo} */
|
| - this.pairingInfo = {clientId: '', sharedSecret: ''};
|
| -};
|
| -
|
| -remoting.Host.Options.prototype.save = function() {
|
| - // TODO(kelvinp): Migrate pairingInfo to use this class as well and get rid of
|
| - // remoting.HostSettings.
|
| - remoting.HostSettings.save(this.hostId_, this);
|
| -};
|
| -
|
| -
|
| -/** @return {Promise} A promise that resolves when the settings are loaded. */
|
| -remoting.Host.Options.prototype.load = function() {
|
| - var that = this;
|
| - return base.Promise.as(remoting.HostSettings.load, [this.hostId_]).then(
|
| - /**
|
| - * @param {Object<string|boolean|number|!Object>} options
|
| - */
|
| - function(options) {
|
| - // Must be defaulted to true so that app-remoting can resize the host
|
| - // upon launching.
|
| - // TODO(kelvinp): Uses a separate host options for app-remoting that
|
| - // hardcodes resizeToClient to true.
|
| - that.resizeToClient =
|
| - base.getBooleanAttr(options, 'resizeToClient', true);
|
| - that.shrinkToFit = base.getBooleanAttr(options, 'shrinkToFit', true);
|
| - that.desktopScale = base.getNumberAttr(options, 'desktopScale', 1);
|
| - that.pairingInfo =
|
| - /** @type {remoting.PairingInfo} */ (
|
| - base.getObjectAttr(options, 'pairingInfo', that.pairingInfo));
|
| -
|
| - // Load the key remappings, allowing for either old or new formats.
|
| - var remappings = /** string|!Object */ (options['remapKeys']);
|
| - if (typeof(remappings) === 'string') {
|
| - remappings = remoting.Host.Options.convertRemapKeys(remappings);
|
| - } else if (typeof(remappings) !== 'object') {
|
| - remappings = {};
|
| - }
|
| - that.remapKeys = /** @type {!Object} */ (base.deepCopy(remappings));
|
| - });
|
| -};
|
| -
|
| -/**
|
| - * Convert an old-style string key remapping into a new-style dictionary one.
|
| - *
|
| - * @param {string} remappings
|
| - * @return {!Object} The same remapping expressed as a dictionary.
|
| - */
|
| -remoting.Host.Options.convertRemapKeys = function(remappings) {
|
| - var remappingsArr = remappings.split(',');
|
| - var result = {};
|
| - for (var i = 0; i < remappingsArr.length; ++i) {
|
| - var keyCodes = remappingsArr[i].split('>');
|
| - if (keyCodes.length != 2) {
|
| - console.log('bad remapKey: ' + remappingsArr[i]);
|
| - continue;
|
| - }
|
| - var fromKey = parseInt(keyCodes[0], 0);
|
| - var toKey = parseInt(keyCodes[1], 0);
|
| - if (!fromKey || !toKey) {
|
| - console.log('bad remapKey code: ' + remappingsArr[i]);
|
| - continue;
|
| - }
|
| - result[fromKey] = toKey;
|
| - }
|
| - return result;
|
| + /** @type {remoting.HostOptions} */
|
| + this.options = new remoting.HostOptions(hostId);
|
| };
|
|
|
| /**
|
|
|