Commit c168caec authored by vitalyp's avatar vitalyp Committed by Commit bot

Compile chrome://settings, part 6

R=dbeam@chromium.org
BUG=393873
TEST=GYP_GENERATORS=ninja gyp --depth . chrome/browser/resources/options/compiled_resources.gyp && ninja -C out/Default | grep ERROR | wc -l

Review URL: https://codereview.chromium.org/570503002

Cr-Commit-Position: refs/heads/master@{#295606}
parent f765cb48
...@@ -9,10 +9,12 @@ var keyboard = {}; ...@@ -9,10 +9,12 @@ var keyboard = {};
/** /**
* Swallows keypress and keyup events of arrow keys. * Swallows keypress and keyup events of arrow keys.
* @param {KeyboardEvent} event Raised event. * @param {Event} event Raised event.
* @private * @private
*/ */
keyboard.onKeyIgnore_ = function(event) { keyboard.onKeyIgnore_ = function(event) {
event = /** @type {KeyboardEvent} */(event);
if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)
return; return;
...@@ -27,26 +29,28 @@ keyboard.onKeyIgnore_ = function(event) { ...@@ -27,26 +29,28 @@ keyboard.onKeyIgnore_ = function(event) {
/** /**
* Converts arrow keys into tab/shift-tab key events. * Converts arrow keys into tab/shift-tab key events.
* @param {KeyboardEvent} event Raised event. * @param {Event} event Raised event.
* @private * @private
*/ */
keyboard.onKeyDown_ = function(event) { keyboard.onKeyDown_ = function(event) {
if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) event = /** @type {KeyboardEvent} */(event);
return;
var needsUpDownKeys = event.target.classList.contains('needs-up-down-keys'); if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)
return;
if (event.keyIdentifier == 'Left' || var needsUpDownKeys = event.target.classList.contains('needs-up-down-keys');
(!needsUpDownKeys && event.keyIdentifier == 'Up')) {
keyboard.raiseKeyFocusPrevious(document.activeElement); if (event.keyIdentifier == 'Left' ||
event.stopPropagation(); (!needsUpDownKeys && event.keyIdentifier == 'Up')) {
event.preventDefault(); keyboard.raiseKeyFocusPrevious(document.activeElement);
} else if (event.keyIdentifier == 'Right' || event.stopPropagation();
(!needsUpDownKeys && event.keyIdentifier == 'Down')) { event.preventDefault();
keyboard.raiseKeyFocusNext(document.activeElement); } else if (event.keyIdentifier == 'Right' ||
event.stopPropagation(); (!needsUpDownKeys && event.keyIdentifier == 'Down')) {
event.preventDefault(); keyboard.raiseKeyFocusNext(document.activeElement);
} event.stopPropagation();
event.preventDefault();
}
}; };
/** /**
......
...@@ -125,7 +125,9 @@ cr.define('options', function() { ...@@ -125,7 +125,9 @@ cr.define('options', function() {
decorate: function() { decorate: function() {
Grid.prototype.decorate.call(this); Grid.prototype.decorate.call(this);
this.dataModel = new ArrayDataModel([]); this.dataModel = new ArrayDataModel([]);
this.itemConstructor = UserImagesGridItem; this.itemConstructor =
/** @type {function(new:cr.ui.ListItem, Object)} */(
UserImagesGridItem);
this.selectionModel = new ListSingleSelectionModel(); this.selectionModel = new ListSingleSelectionModel();
this.inProgramSelection_ = false; this.inProgramSelection_ = false;
this.addEventListener('dblclick', this.handleDblClick_.bind(this)); this.addEventListener('dblclick', this.handleDblClick_.bind(this));
......
...@@ -662,7 +662,8 @@ cr.define('options', function() { ...@@ -662,7 +662,8 @@ cr.define('options', function() {
true); true);
document.body.addEventListener('click', function(e) { document.body.addEventListener('click', function(e) {
var button = findAncestor(e.target, function(el) { var target = assertInstanceof(e.target, Node);
var button = findAncestor(target, function(el) {
return el.tagName == 'BUTTON' && return el.tagName == 'BUTTON' &&
el.dataset.extensionId !== undefined && el.dataset.extensionId !== undefined &&
el.dataset.extensionId.length; el.dataset.extensionId.length;
...@@ -718,7 +719,7 @@ cr.define('options', function() { ...@@ -718,7 +719,7 @@ cr.define('options', function() {
* @private * @private
*/ */
handleWindowMessage_: function(e) { handleWindowMessage_: function(e) {
if (e.data.method == 'frameSelected') if ((/** @type {{method: string}} */(e.data)).method == 'frameSelected')
$('search-field').focus(); $('search-field').focus();
}, },
...@@ -1252,7 +1253,8 @@ cr.define('options', function() { ...@@ -1252,7 +1253,8 @@ cr.define('options', function() {
/** /**
* Get the selected profile item from the profile list. This also works * Get the selected profile item from the profile list. This also works
* correctly if the list is not displayed. * correctly if the list is not displayed.
* @return {Object} the profile item object, or null if nothing is selected. * @return {?Object} The profile item object, or null if nothing is
* selected.
* @private * @private
*/ */
getSelectedProfileItem_: function() { getSelectedProfileItem_: function() {
......
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/**
* @typedef {{
* id: string,
* name: string,
* subnodes: Array.<{id: string, name: string, readonly: boolean,
* untrusted: boolean, extractable: boolean,
* policy: boolean}>
* }}
*/
var CertificateData;
cr.define('options', function() { cr.define('options', function() {
/** @const */ var Tree = cr.ui.Tree; /** @const */ var Tree = cr.ui.Tree;
/** @const */ var TreeItem = cr.ui.TreeItem; /** @const */ var TreeItem = cr.ui.TreeItem;
...@@ -132,7 +143,7 @@ cr.define('options', function() { ...@@ -132,7 +143,7 @@ cr.define('options', function() {
/** /**
* Populate the tree. * Populate the tree.
* @param {Array} nodesData Nodes data array. * @param {Array.<CertificateData>} nodesData Nodes data array.
*/ */
populate: function(nodesData) { populate: function(nodesData) {
this.clear(); this.clear();
......
...@@ -36,6 +36,10 @@ cr.define('options.accounts', function() { ...@@ -36,6 +36,10 @@ cr.define('options.accounts', function() {
}); });
}, },
/**
* @override
* @param {Object} user
*/
createItem: function(user) { createItem: function(user) {
return new UserListItem(user); return new UserListItem(user);
}, },
......
...@@ -105,7 +105,7 @@ cr.define('options.accounts', function() { ...@@ -105,7 +105,7 @@ cr.define('options.accounts', function() {
/** /**
* Handler for key down event. * Handler for key down event.
* @private * @private
* @param {!Event} e The keydown event object. * @param {Event} e The keydown event object.
*/ */
handleKeyDown_: function(e) { handleKeyDown_: function(e) {
if (e.keyIdentifier == 'Enter') { if (e.keyIdentifier == 'Enter') {
......
...@@ -57,16 +57,7 @@ cr.define('options', function() { ...@@ -57,16 +57,7 @@ cr.define('options', function() {
/** /**
* Description of the bluetooth device. * Description of the bluetooth device.
* @type {{name: string, * @type {?BluetoothDevice}
* address: string,
* paired: boolean,
* connected: boolean,
* connecting: boolean,
* connectable: boolean,
* pairing: (string|undefined),
* passkey: (number|undefined),
* pincode: (string|undefined),
* entered: (number|undefined)}}
* @private * @private
*/ */
device_: null, device_: null,
...@@ -170,11 +161,11 @@ cr.define('options', function() { ...@@ -170,11 +161,11 @@ cr.define('options', function() {
* @param {Object} device Description of the bluetooth device. * @param {Object} device Description of the bluetooth device.
*/ */
update: function(device) { update: function(device) {
this.device_ = {}; this.device_ = /** @type {BluetoothDevice} */({});
for (var key in device) for (var key in device)
this.device_[key] = device[key]; this.device_[key] = device[key];
// Update the pairing instructions. // Update the pairing instructions.
var instructionsEl = $('bluetooth-pairing-instructions'); var instructionsEl = assert($('bluetooth-pairing-instructions'));
this.clearElement_(instructionsEl); this.clearElement_(instructionsEl);
this.dismissible_ = ('dismissible' in device) ? this.dismissible_ = ('dismissible' in device) ?
device.dismissible : true; device.dismissible : true;
...@@ -228,7 +219,7 @@ cr.define('options', function() { ...@@ -228,7 +219,7 @@ cr.define('options', function() {
/** /**
* Handles the ENTER key for the passkey or pincode entry field. * Handles the ENTER key for the passkey or pincode entry field.
* @return {Event} a keydown event. * @param {Event} event A keydown event.
* @private * @private
*/ */
keyDownEventHandler_: function(event) { keyDownEventHandler_: function(event) {
...@@ -275,7 +266,7 @@ cr.define('options', function() { ...@@ -275,7 +266,7 @@ cr.define('options', function() {
* @param {string} key Passkey or PIN to display. * @param {string} key Passkey or PIN to display.
*/ */
updatePasskey_: function(key) { updatePasskey_: function(key) {
var passkeyEl = $('bluetooth-pairing-passkey-display'); var passkeyEl = assert($('bluetooth-pairing-passkey-display'));
var keyClass = (this.device_.pairing == PAIRING.REMOTE_PASSKEY || var keyClass = (this.device_.pairing == PAIRING.REMOTE_PASSKEY ||
this.device_.pairing == PAIRING.REMOTE_PIN_CODE) ? this.device_.pairing == PAIRING.REMOTE_PIN_CODE) ?
'bluetooth-keyboard-button' : 'bluetooth-passkey-char'; 'bluetooth-keyboard-button' : 'bluetooth-passkey-char';
......
...@@ -274,7 +274,8 @@ cr.define('options', function() { ...@@ -274,7 +274,8 @@ cr.define('options', function() {
return true; return true;
e.preventDefault(); e.preventDefault();
return this.startDragging_(e.target, {x: e.pageX, y: e.pageY}); var target = assertInstanceof(e.target, HTMLElement);
return this.startDragging_(target, {x: e.pageX, y: e.pageY});
}, },
/** /**
...@@ -292,7 +293,8 @@ cr.define('options', function() { ...@@ -292,7 +293,8 @@ cr.define('options', function() {
e.preventDefault(); e.preventDefault();
var touch = e.touches[0]; var touch = e.touches[0];
this.lastTouchLocation_ = {x: touch.pageX, y: touch.pageY}; this.lastTouchLocation_ = {x: touch.pageX, y: touch.pageY};
return this.startDragging_(e.target, this.lastTouchLocation_); var target = assertInstanceof(e.target, HTMLElement);
return this.startDragging_(target, this.lastTouchLocation_);
}, },
/** /**
......
...@@ -387,11 +387,13 @@ cr.define('options.internet', function() { ...@@ -387,11 +387,13 @@ cr.define('options.internet', function() {
* Creates an indicator event for controlled properties using * Creates an indicator event for controlled properties using
* the same dictionary format as CoreOptionsHandler::CreateValueForPref. * the same dictionary format as CoreOptionsHandler::CreateValueForPref.
* @param {string} name The name for the Event. * @param {string} name The name for the Event.
* @param {!{value: *, controlledBy: *, recommendedValue: *}} propData * @param {{value: *, controlledBy: *, recommendedValue: *}} propData
* Property dictionary, * Property dictionary.
* @private * @private
*/ */
createControlledEvent_: function(name, propData) { createControlledEvent_: function(name, propData) {
assert('value' in propData && 'controlledBy' in propData &&
'recommendedValue' in propData);
var event = new Event(name); var event = new Event(name);
event.value = { event.value = {
value: propData.value, value: propData.value,
...@@ -1569,11 +1571,14 @@ cr.define('options.internet', function() { ...@@ -1569,11 +1571,14 @@ cr.define('options.internet', function() {
onc.getActiveValue(propName); onc.getActiveValue(propName);
if (propValue == undefined) if (propValue == undefined)
continue; continue;
propValue = assertInstanceof(propValue, Object);
var event; var event;
if (managed) if (managed)
event = detailsPage.createManagedEvent_(propName, propValue); event = detailsPage.createManagedEvent_(propName, propValue);
else else
event = detailsPage.createControlledEvent_(propName, propValue); event = detailsPage.createControlledEvent_(propName,
/** @type {{value: *, controlledBy: *, recommendedValue: *}} */(
propValue));
indicators[i].handlePrefChange(event); indicators[i].handlePrefChange(event);
var forElement = $(indicators[i].getAttribute('for')); var forElement = $(indicators[i].getAttribute('for'));
if (forElement) { if (forElement) {
......
...@@ -33,7 +33,8 @@ cr.define('options', function() { ...@@ -33,7 +33,8 @@ cr.define('options', function() {
options.SettingsDialog.call(this, 'keyboard-overlay', options.SettingsDialog.call(this, 'keyboard-overlay',
loadTimeData.getString('keyboardOverlayTabTitle'), loadTimeData.getString('keyboardOverlayTabTitle'),
'keyboard-overlay', 'keyboard-overlay',
$('keyboard-confirm'), $('keyboard-cancel')); assertInstanceof($('keyboard-confirm'), HTMLButtonElement),
assertInstanceof($('keyboard-cancel'), HTMLButtonElement));
} }
cr.addSingletonGetter(KeyboardOverlay); cr.addSingletonGetter(KeyboardOverlay);
......
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/**
* @typedef {{
* ConnectionState: string,
* iconURL: string,
* policyManaged: boolean,
* servicePath: string
* }}
* @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
*/
var NetworkInfo;
cr.define('options.network', function() { cr.define('options.network', function() {
var ArrayDataModel = cr.ui.ArrayDataModel; var ArrayDataModel = cr.ui.ArrayDataModel;
var List = cr.ui.List; var List = cr.ui.List;
...@@ -392,8 +403,8 @@ cr.define('options.network', function() { ...@@ -392,8 +403,8 @@ cr.define('options.network', function() {
/** /**
* Creates a control for selecting or configuring a network connection based * Creates a control for selecting or configuring a network connection based
* on the type of connection (e.g. wifi versus vpn). * on the type of connection (e.g. wifi versus vpn).
* @param {{key: string, networkList: Array.<Object>}} data Description of the * @param {{key: string, networkList: Array.<NetworkInfo>}} data Description
* network. * of the network.
* @constructor * @constructor
* @extends {NetworkMenuItem} * @extends {NetworkMenuItem}
*/ */
...@@ -654,7 +665,7 @@ cr.define('options.network', function() { ...@@ -654,7 +665,7 @@ cr.define('options.network', function() {
/** /**
* Extracts a mapping of network names to menu element and position. * Extracts a mapping of network names to menu element and position.
* @param {!Element} menu The menu to process. * @param {!Element} menu The menu to process.
* @return {Object.<string, {index: number, button: Element}>} * @return {Object.<string, ?{index: number, button: Element}>}
* Network mapping. * Network mapping.
* @private * @private
*/ */
...@@ -923,12 +934,19 @@ cr.define('options.network', function() { ...@@ -923,12 +934,19 @@ cr.define('options.network', function() {
this.endBatchUpdates(); this.endBatchUpdates();
}, },
/** @override */ /**
* @override
* @param {Object} entry
*/
createItem: function(entry) { createItem: function(entry) {
if (entry.networkList) if (entry.networkList)
return new NetworkSelectorItem(entry); return new NetworkSelectorItem(
/** @type {{key: string, networkList: Array.<NetworkInfo>}} */(
entry));
if (entry.command) if (entry.command)
return new NetworkButtonItem(entry); return new NetworkButtonItem(
/** @type {{key: string, subtitle: string, command: Function}} */(
entry));
if (entry.menu) if (entry.menu)
return new NetworkMenuItem(entry); return new NetworkMenuItem(entry);
return undefined; return undefined;
...@@ -971,12 +989,12 @@ cr.define('options.network', function() { ...@@ -971,12 +989,12 @@ cr.define('options.network', function() {
/** /**
* Chrome callback for updating network controls. * Chrome callback for updating network controls.
* @param {{wiredList: Array, wirelessList: Array, vpnList: Array, * @param {{wiredList: Array.<NetworkInfo>, wirelessList: Array.<NetworkInfo>,
* rememberedList: Array, wifiAvailable: boolean, wifiEnabled: boolean, * vpnList: Array.<NetworkInfo>, rememberedList: Array.<NetworkInfo>,
* wimaxAvailable: boolean, wimaxEnabled: boolean, * wifiAvailable: boolean, wifiEnabled: boolean, wimaxAvailable: boolean,
* cellularAvailable: boolean, cellularEnabled: boolean, * wimaxEnabled: boolean, cellularAvailable: boolean,
* cellularSupportsScan: boolean}} data Description of available network * cellularEnabled: boolean, cellularSupportsScan: boolean}} data
* devices and their corresponding state. * Description of available network devices and their corresponding state.
*/ */
NetworkList.refreshNetworkData = function(data) { NetworkList.refreshNetworkData = function(data) {
var networkList = $('network-list'); var networkList = $('network-list');
......
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
* ONC managed or unmanaged dictionaries. Supports nested dictionaries, * ONC managed or unmanaged dictionaries. Supports nested dictionaries,
* e.g. data.getManagedProperty('VPN.Type'). * e.g. data.getManagedProperty('VPN.Type').
*/ */
cr.exportPath('cr.onc');
/**
* @typedef {(Object|Array|string|undefined)}
*/
cr.onc.OncValue;
cr.define('cr.onc', function() { cr.define('cr.onc', function() {
'use strict'; 'use strict';
...@@ -22,8 +30,8 @@ cr.define('cr.onc', function() { ...@@ -22,8 +30,8 @@ cr.define('cr.onc', function() {
/** /**
* Returns either a managed property dictionary or an unmanaged value. * Returns either a managed property dictionary or an unmanaged value.
* @param {string} key The property key. * @param {string} key The property key.
* @return {*} The property value or dictionary if it exists, otherwise * @return {cr.onc.OncValue} The property value or dictionary if it exists,
* undefined. * otherwise undefined.
*/ */
getManagedProperty: function(key) { getManagedProperty: function(key) {
var data = this.data_; var data = this.data_;
...@@ -44,7 +52,7 @@ cr.define('cr.onc', function() { ...@@ -44,7 +52,7 @@ cr.define('cr.onc', function() {
* Sets the value of a property. Currently only supports unmanaged * Sets the value of a property. Currently only supports unmanaged
* properties. * properties.
* @param {string} key The property key. * @param {string} key The property key.
* @param {string} value The property value to set. * @param {Object} value The property value to set.
*/ */
setManagedProperty: function(key, value) { setManagedProperty: function(key, value) {
var data = this.data_; var data = this.data_;
...@@ -76,7 +84,7 @@ cr.define('cr.onc', function() { ...@@ -76,7 +84,7 @@ cr.define('cr.onc', function() {
/** /**
* Gets the active value of a property. * Gets the active value of a property.
* @param {string} key The property key. * @param {string} key The property key.
* @return {*} The property value or undefined. * @return {cr.onc.OncValue} The property value or undefined.
*/ */
getActiveValue: function(key) { getActiveValue: function(key) {
var property = this.getManagedProperty(key); var property = this.getManagedProperty(key);
...@@ -86,7 +94,8 @@ cr.define('cr.onc', function() { ...@@ -86,7 +94,8 @@ cr.define('cr.onc', function() {
if ('Active' in property) if ('Active' in property)
return property['Active']; return property['Active'];
// If no Active value is defined, return the effective value if present. // If no Active value is defined, return the effective value if present.
var effective = this.getEffectiveValueFromProperty_(property); var effective = this.getEffectiveValueFromProperty_(
/** @type {Object} */(property));
if (effective != undefined) if (effective != undefined)
return effective; return effective;
// Otherwise this is an Object but not a Managed one. // Otherwise this is an Object but not a Managed one.
...@@ -97,7 +106,8 @@ cr.define('cr.onc', function() { ...@@ -97,7 +106,8 @@ cr.define('cr.onc', function() {
* Gets the translated ONC value from the result of getActiveValue() using * Gets the translated ONC value from the result of getActiveValue() using
* loadTimeData. If no translation exists, returns the untranslated value. * loadTimeData. If no translation exists, returns the untranslated value.
* @param {string} key The property key. * @param {string} key The property key.
* @return {*} The translation if available or the value if not. * @return {cr.onc.OncValue} The translation if available or the value if
* not.
*/ */
getTranslatedValue: function(key) { getTranslatedValue: function(key) {
var value = this.getActiveValue(key); var value = this.getActiveValue(key);
...@@ -121,7 +131,7 @@ cr.define('cr.onc', function() { ...@@ -121,7 +131,7 @@ cr.define('cr.onc', function() {
/** /**
* Gets the recommended value of a property. * Gets the recommended value of a property.
* @param {string} key The property key. * @param {string} key The property key.
* @return {*} The property value or undefined. * @return {cr.onc.OncValue} The property value or undefined.
*/ */
getRecommendedValue: function(key) { getRecommendedValue: function(key) {
var property = this.getManagedProperty(key); var property = this.getManagedProperty(key);
...@@ -161,7 +171,7 @@ cr.define('cr.onc', function() { ...@@ -161,7 +171,7 @@ cr.define('cr.onc', function() {
/** /**
* Get the effective value from a Managed property ONC dictionary. * Get the effective value from a Managed property ONC dictionary.
* @param {Object} property The managed property ONC dictionary. * @param {Object} property The managed property ONC dictionary.
* @return {*} The effective value or undefined. * @return {cr.onc.OncValue} The effective value or undefined.
* @private * @private
*/ */
getEffectiveValueFromProperty_: function(property) { getEffectiveValueFromProperty_: function(property) {
......
...@@ -15,9 +15,9 @@ cr.define('options', function() { ...@@ -15,9 +15,9 @@ cr.define('options', function() {
// The title is updated dynamically in the setTitle method as pointer // The title is updated dynamically in the setTitle method as pointer
// devices are discovered or removed. // devices are discovered or removed.
SettingsDialog.call(this, 'pointer-overlay', SettingsDialog.call(this, 'pointer-overlay',
'', 'pointer-overlay', '', 'pointer-overlay',
$('pointer-overlay-confirm'), assertInstanceof($('pointer-overlay-confirm'), HTMLButtonElement),
$('pointer-overlay-cancel')); assertInstanceof($('pointer-overlay-cancel'), HTMLButtonElement));
} }
cr.addSingletonGetter(PointerOverlay); cr.addSingletonGetter(PointerOverlay);
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('options');
/**
* @typedef {{Name: string, Type: string, servicePath: string}}
*/
options.PreferredNetwork;
cr.define('options', function() { cr.define('options', function() {
var Page = cr.ui.pageManager.Page; var Page = cr.ui.pageManager.Page;
...@@ -19,7 +26,7 @@ cr.define('options', function() { ...@@ -19,7 +26,7 @@ cr.define('options', function() {
* @extends {cr.ui.pageManager.Page} * @extends {cr.ui.pageManager.Page}
*/ */
function PreferredNetworks(model) { function PreferredNetworks(model) {
Page.call(this, 'preferredNetworksPage', null, 'preferredNetworksPage'); Page.call(this, 'preferredNetworksPage', '', 'preferredNetworksPage');
} }
cr.addSingletonGetter(PreferredNetworks); cr.addSingletonGetter(PreferredNetworks);
...@@ -48,8 +55,7 @@ cr.define('options', function() { ...@@ -48,8 +55,7 @@ cr.define('options', function() {
/** /**
* Creates a list entry for a remembered network. * Creates a list entry for a remembered network.
* @param {{Name: string, Type: string, servicePath: string}} data * @param {options.PreferredNetwork} data Description of the network.
* Description of the network.
* @constructor * @constructor
* @extends {options.DeletableItem} * @extends {options.DeletableItem}
*/ */
...@@ -68,7 +74,7 @@ cr.define('options', function() { ...@@ -68,7 +74,7 @@ cr.define('options', function() {
/** /**
* Description of the network. * Description of the network.
* @type {{Name: string, Type: string, servicePath: string}} * @type {?options.PreferredNetwork}
*/ */
data: null, data: null,
...@@ -108,7 +114,10 @@ cr.define('options', function() { ...@@ -108,7 +114,10 @@ cr.define('options', function() {
this.selectionModel.unselectAll(); this.selectionModel.unselectAll();
}, },
/** @override */ /**
* @override
* @param {options.PreferredNetwork} entry
*/
createItem: function(entry) { createItem: function(entry) {
return new PreferredNetworkListItem(entry); return new PreferredNetworkListItem(entry);
}, },
...@@ -140,8 +149,7 @@ cr.define('options', function() { ...@@ -140,8 +149,7 @@ cr.define('options', function() {
/** /**
* Adds a remembered network to the list. * Adds a remembered network to the list.
* @param {{Name: string, Type: string, servicePath: string}} data * @param {options.PreferredNetwork} data Description of the network.
* Description of the network.
*/ */
append: function(data) { append: function(data) {
this.dataModel.push(data); this.dataModel.push(data);
......
...@@ -39,6 +39,10 @@ cr.define('options.proxyexceptions', function() { ...@@ -39,6 +39,10 @@ cr.define('options.proxyexceptions', function() {
}); });
}, },
/**
* @override
* @param {Object} exception
*/
createItem: function(exception) { createItem: function(exception) {
return new ProxyExceptionsItem(exception); return new ProxyExceptionsItem(exception);
}, },
......
...@@ -17,8 +17,9 @@ cr.define('options', function() { ...@@ -17,8 +17,9 @@ cr.define('options', function() {
this, 'thirdPartyImeConfirm', this, 'thirdPartyImeConfirm',
loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'), loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'),
'third-party-ime-confirm-overlay', 'third-party-ime-confirm-overlay',
$('third-party-ime-confirm-ok'), assertInstanceof($('third-party-ime-confirm-ok'), HTMLButtonElement),
$('third-party-ime-confirm-cancel')); assertInstanceof($('third-party-ime-confirm-cancel'),
HTMLButtonElement));
} }
cr.addSingletonGetter(ThirdPartyImeConfirmOverlay); cr.addSingletonGetter(ThirdPartyImeConfirmOverlay);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
'../../../../ui/webui/resources/js/load_time_data.js', '../../../../ui/webui/resources/js/load_time_data.js',
'../../../../ui/webui/resources/js/parse_html_subset.js', '../../../../ui/webui/resources/js/parse_html_subset.js',
'../../../../ui/webui/resources/js/util.js', '../../../../ui/webui/resources/js/util.js',
'../../../../chrome/browser/resources/chromeos/keyboard/keyboard_utils.js',
], ],
'externs': ['<(CLOSURE_DIR)/externs/chrome_send_externs.js'], 'externs': ['<(CLOSURE_DIR)/externs/chrome_send_externs.js'],
}, },
......
...@@ -152,7 +152,8 @@ cr.define('options', function() { ...@@ -152,7 +152,8 @@ cr.define('options', function() {
var target = e.target; var target = e.target;
if (target.classList.contains('row-delete-button')) { if (target.classList.contains('row-delete-button')) {
var listItem = this.getListItemAncestor(target); var listItem = this.getListItemAncestor(
/** @type {HTMLElement} */(target));
var idx = this.getIndexOfListItem(listItem); var idx = this.getIndexOfListItem(listItem);
this.deleteItemAtIndex(idx); this.deleteItemAtIndex(idx);
} }
......
...@@ -42,7 +42,11 @@ cr.define('options', function() { ...@@ -42,7 +42,11 @@ cr.define('options', function() {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// PrefInputElement class: // PrefInputElement class:
// Define a constructor that uses an input element as its underlying element. /**
* Define a constructor that uses an input element as its underlying element.
* @constructor
* @extends {HTMLInputElement}
*/
var PrefInputElement = cr.ui.define('input'); var PrefInputElement = cr.ui.define('input');
PrefInputElement.prototype = { PrefInputElement.prototype = {
...@@ -323,8 +327,11 @@ cr.define('options', function() { ...@@ -323,8 +327,11 @@ cr.define('options', function() {
* @private * @private
*/ */
updatePrefFromState_: function() { updatePrefFromState_: function() {
Preferences.setIntegerPref(this.pref, this.mapPositionToPref(this.value), Preferences.setIntegerPref(
!this.dialogPref, this.metric); this.pref,
this.mapPositionToPref(parseInt(this.value, 10)),
!this.dialogPref,
this.metric);
}, },
/** /**
...@@ -575,6 +582,7 @@ cr.define('options', function() { ...@@ -575,6 +582,7 @@ cr.define('options', function() {
// Export // Export
return { return {
PrefCheckbox: PrefCheckbox, PrefCheckbox: PrefCheckbox,
PrefInputElement: PrefInputElement,
PrefNumber: PrefNumber, PrefNumber: PrefNumber,
PrefRadio: PrefRadio, PrefRadio: PrefRadio,
PrefRange: PrefRange, PrefRange: PrefRange,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment