Commit 7abe92ad authored by vitalyp's avatar vitalyp Committed by Commit bot

Compile chrome://settings, part 8: the final battle

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/566063002

Cr-Commit-Position: refs/heads/master@{#297461}
parent 25e25628
...@@ -246,6 +246,7 @@ cr.define('options', function() { ...@@ -246,6 +246,7 @@ cr.define('options', function() {
* |true|, capture is started immediately. * |true|, capture is started immediately.
* @param {!MediaStream} stream Stream object as returned by getUserMedia. * @param {!MediaStream} stream Stream object as returned by getUserMedia.
* @private * @private
* @suppress {deprecated}
*/ */
handleCameraAvailable_: function(onAvailable, stream) { handleCameraAvailable_: function(onAvailable, stream) {
if (this.cameraStartInProgress_ && onAvailable()) { if (this.cameraStartInProgress_ && onAvailable()) {
......
...@@ -12,7 +12,6 @@ cr.exportPath('options'); ...@@ -12,7 +12,6 @@ cr.exportPath('options');
* setupCompleted: (boolean|undefined), * setupCompleted: (boolean|undefined),
* setupInProgress: (boolean|undefined), * setupInProgress: (boolean|undefined),
* signedIn: (boolean|undefined), * signedIn: (boolean|undefined),
* signinAllowed: (boolean|undefined),
* signinAllowed: boolean, * signinAllowed: boolean,
* signoutAllowed: (boolean|undefined), * signoutAllowed: (boolean|undefined),
* statusText: (string|undefined), * statusText: (string|undefined),
...@@ -21,6 +20,11 @@ cr.exportPath('options'); ...@@ -21,6 +20,11 @@ cr.exportPath('options');
*/ */
options.SyncStatus; options.SyncStatus;
/**
* @typedef {{id: string, name: string}}
*/
options.ExtensionData;
cr.define('options', function() { cr.define('options', function() {
var OptionsPage = options.OptionsPage; var OptionsPage = options.OptionsPage;
var Page = cr.ui.pageManager.Page; var Page = cr.ui.pageManager.Page;
...@@ -1791,8 +1795,12 @@ cr.define('options', function() { ...@@ -1791,8 +1795,12 @@ cr.define('options', function() {
/** /**
* Toggles the warning boxes that show which extension is controlling * Toggles the warning boxes that show which extension is controlling
* various settings of Chrome. * various settings of Chrome.
* @param {object} details A dictionary of ID+name pairs for each of the * @param {{searchEngine: options.ExtensionData,
* settings controlled by an extension. * homePage: options.ExtensionData,
* startUpPage: options.ExtensionData,
* newTabPage: options.ExtensionData,
* proxy: options.ExtensionData}} details A dictionary of ID+name
* pairs for each of the settings controlled by an extension.
* @private * @private
*/ */
toggleExtensionIndicators_: function(details) { toggleExtensionIndicators_: function(details) {
......
...@@ -24,7 +24,7 @@ cr.define('options', function() { ...@@ -24,7 +24,7 @@ cr.define('options', function() {
/** /**
* The ID of the target display. * The ID of the target display.
* @private * @private {?string}
*/ */
id_: null, id_: null,
......
...@@ -1294,7 +1294,9 @@ cr.define('options.internet', function() { ...@@ -1294,7 +1294,9 @@ cr.define('options.internet', function() {
} }
var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix');
if (savedPrefix != undefined) { if (savedPrefix != undefined) {
var savedNetmask = prefixLengthToNetmask(savedPrefix); assert(typeof savedPrefix == 'number');
var savedNetmask = prefixLengthToNetmask(
/** @type {number} */(savedPrefix));
inetNetmask.automatic = savedNetmask; inetNetmask.automatic = savedNetmask;
inetNetmask.value = savedNetmask; inetNetmask.value = savedNetmask;
} }
...@@ -1320,7 +1322,9 @@ cr.define('options.internet', function() { ...@@ -1320,7 +1322,9 @@ cr.define('options.internet', function() {
} }
var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix');
if (staticPrefix != undefined) { if (staticPrefix != undefined) {
var staticNetmask = prefixLengthToNetmask(staticPrefix); assert(typeof staticPrefix == 'number');
var staticNetmask = prefixLengthToNetmask(
/** @type {number} */(staticPrefix));
inetNetmask.user = staticNetmask; inetNetmask.user = staticNetmask;
inetNetmask.value = staticNetmask; inetNetmask.value = staticNetmask;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
cr.exportPath('cr.onc'); cr.exportPath('cr.onc');
/** /**
* @typedef {(Object|Array|string|undefined)} * @typedef {(Object|Array|string|number|undefined)}
*/ */
cr.onc.OncValue; cr.onc.OncValue;
...@@ -154,6 +154,7 @@ cr.define('cr.onc', function() { ...@@ -154,6 +154,7 @@ cr.define('cr.onc', function() {
var source = this.getActiveValue('Source'); var source = this.getActiveValue('Source');
if (source == undefined) if (source == undefined)
return 'None'; return 'None';
assert(typeof source == 'string');
return source; return source;
}, },
...@@ -165,6 +166,7 @@ cr.define('cr.onc', function() { ...@@ -165,6 +166,7 @@ cr.define('cr.onc', function() {
var security = this.getActiveValue('WiFi.Security'); var security = this.getActiveValue('WiFi.Security');
if (security == undefined) if (security == undefined)
return 'None'; return 'None';
assert(typeof security == 'string');
return security; return security;
}, },
......
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
// 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 {{appId: string,
* appName: (string|undefined),
* embeddingOrigin: (string|undefined),
* origin: string,
* setting: string,
* source: string,
* video: (string|undefined)}}
*/
options.Exception;
cr.define('options', function() { cr.define('options', function() {
/** @const */ var Page = cr.ui.pageManager.Page; /** @const */ var Page = cr.ui.pageManager.Page;
/** @const */ var PageManager = cr.ui.pageManager.PageManager; /** @const */ var PageManager = cr.ui.pageManager.PageManager;
...@@ -118,8 +131,8 @@ cr.define('options', function() { ...@@ -118,8 +131,8 @@ cr.define('options', function() {
/** /**
* Sets the values for all the content settings radios and labels. * Sets the values for all the content settings radios and labels.
* @param {Object} dict A mapping from radio groups to the checked value for * @param {Object.<string, {managedBy: string, value: string}>} dict A mapping
* that group. * from radio groups to the checked value for that group.
*/ */
ContentSettings.setContentFilterSettingsValue = function(dict) { ContentSettings.setContentFilterSettingsValue = function(dict) {
for (var group in dict) { for (var group in dict) {
...@@ -205,9 +218,9 @@ cr.define('options', function() { ...@@ -205,9 +218,9 @@ cr.define('options', function() {
/** /**
* Initializes an exceptions list. * Initializes an exceptions list.
* @param {string} type The content type that we are setting exceptions for. * @param {string} type The content type that we are setting exceptions for.
* @param {Array} exceptions An array of pairs, where the first element of * @param {Array.<options.Exception>} exceptions An array of pairs, where the
* each pair is the filter string, and the second is the setting * first element of each pair is the filter string, and the second is the
* (allow/block). * setting (allow/block).
*/ */
ContentSettings.setExceptions = function(type, exceptions) { ContentSettings.setExceptions = function(type, exceptions) {
this.getExceptionsList(type, 'normal').setExceptions(exceptions); this.getExceptionsList(type, 'normal').setExceptions(exceptions);
......
...@@ -509,8 +509,8 @@ cr.define('options.contentSettings', function() { ...@@ -509,8 +509,8 @@ cr.define('options.contentSettings', function() {
/** /**
* Sets the exceptions in the js model. * Sets the exceptions in the js model.
* *
* @param {Object} entries A list of dictionaries of values, each dictionary * @param {Array.<options.Exception>} entries A list of dictionaries of
* represents an exception. * values, each dictionary represents an exception.
*/ */
setExceptions: function(entries) { setExceptions: function(entries) {
var deleteCount = this.dataModel.length; var deleteCount = this.dataModel.length;
......
...@@ -179,7 +179,7 @@ cr.define('options', function() { ...@@ -179,7 +179,7 @@ cr.define('options', function() {
// a handler is installed by policy, removeHandler does nothing. // a handler is installed by policy, removeHandler does nothing.
delegate.setDefault(data.handlers[0]); delegate.setDefault(data.handlers[0]);
for (var i = 0; i < data.handlers.length; ++i) { for (var i = 0; i < data.handlers.length; ++i) {
delegate.removeHandler(value, data.handlers[i]); delegate.removeHandler(i, data.handlers[i]);
} }
}; };
} else { } else {
......
...@@ -418,7 +418,7 @@ cr.define('options', function() { ...@@ -418,7 +418,7 @@ cr.define('options', function() {
* @private * @private
*/ */
onSigninError_: function() { onSigninError_: function() {
this.updateSignedInStatus_(this.signedInEmail_, true); this.updateSignedInStatus(this.signedInEmail_, true);
}, },
/** /**
...@@ -461,8 +461,15 @@ cr.define('options', function() { ...@@ -461,8 +461,15 @@ cr.define('options', function() {
options.SupervisedUserListData.resetPromise(); options.SupervisedUserListData.resetPromise();
}, },
/** @private */ /**
updateSignedInStatus_: assertNotReached, * Abstract method. Should be overriden in subclasses.
* @param {string} email
* @param {boolean} hasError
* @protected
*/
updateSignedInStatus: function(email, hasError) {
assertNotReached();
},
/** /**
* Called when the user clicks "OK" or hits enter. Creates the profile * Called when the user clicks "OK" or hits enter. Creates the profile
...@@ -768,6 +775,15 @@ cr.define('options', function() { ...@@ -768,6 +775,15 @@ cr.define('options', function() {
} }
}, },
/**
* @param {string} email
* @param {boolean} hasError
* @override
*/
updateSignedInStatus: function(email, hasError) {
this.updateSignedInStatus_(email, hasError);
},
/** /**
* Updates the signed-in or not-signed-in UI when in create mode. Called by * Updates the signed-in or not-signed-in UI when in create mode. Called by
* the handler in response to the 'requestCreateProfileUpdate' message. * the handler in response to the 'requestCreateProfileUpdate' message.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
'dependencies': [ 'dependencies': [
'../../chrome/browser/resources/downloads/compiled_resources.gyp:*', '../../chrome/browser/resources/downloads/compiled_resources.gyp:*',
'../../chrome/browser/resources/history/compiled_resources.gyp:*', '../../chrome/browser/resources/history/compiled_resources.gyp:*',
'../../chrome/browser/resources/options/compiled_resources.gyp:*',
'../../chrome/browser/resources/uber/compiled_resources.gyp:*', '../../chrome/browser/resources/uber/compiled_resources.gyp:*',
'../../ui/webui/resources/js/chromeos/compiled_resources.gyp:*', '../../ui/webui/resources/js/chromeos/compiled_resources.gyp:*',
'../../ui/webui/resources/js/compiled_resources.gyp:*', '../../ui/webui/resources/js/compiled_resources.gyp:*',
......
...@@ -236,11 +236,13 @@ cr.define('cr.ui', function() { ...@@ -236,11 +236,13 @@ cr.define('cr.ui', function() {
* Handles focus changes on the document. * Handles focus changes on the document.
* @param {Event} e The focus event object. * @param {Event} e The focus event object.
* @private * @private
* @suppress {checkTypes}
* TODO(vitalyp): remove the suppression.
*/ */
handleFocus_: function(e) { handleFocus_: function(e) {
var target = e.target; var target = e.target;
// Ignore focus on a menu button or command item // Ignore focus on a menu button or command item.
if (target.menu || target.command) if (target.menu || target.command)
return; return;
......
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