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