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

Compile chrome://settings, part 5

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

Cr-Commit-Position: refs/heads/master@{#295552}
parent fee3a512
...@@ -14,8 +14,8 @@ cr.define('options', function() { ...@@ -14,8 +14,8 @@ cr.define('options', function() {
* @param {string} name See Page constructor. * @param {string} name See Page constructor.
* @param {string} title See Page constructor. * @param {string} title See Page constructor.
* @param {string} pageDivName See Page constructor. * @param {string} pageDivName See Page constructor.
* @param {HTMLInputElement} okButton The confirmation button element. * @param {HTMLButtonElement} okButton The confirmation button element.
* @param {HTMLInputElement} cancelButton The cancellation button element. * @param {HTMLButtonElement} cancelButton The cancellation button element.
* @param {string} pref The pref that requires confirmation. * @param {string} pref The pref that requires confirmation.
* @param {string} metric User metrics identifier. * @param {string} metric User metrics identifier.
* @param {string=} opt_confirmedPref A pref used to remember whether the * @param {string=} opt_confirmedPref A pref used to remember whether the
......
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
// 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 {{
* default_handler: number,
* handlers: Array,
* has_policy_recommendations: boolean,
* is_default_handler_set_by_user: boolean,
* protocol: string
* }}
* @see chrome/browser/ui/webui/options/handler_options_handler.cc
*/
var Handlers;
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;
...@@ -12,6 +24,7 @@ cr.define('options', function() { ...@@ -12,6 +24,7 @@ cr.define('options', function() {
/** /**
* Encapsulated handling of handler options page. * Encapsulated handling of handler options page.
* @constructor * @constructor
* @extends {cr.ui.pageManager.Page}
*/ */
function HandlerOptions() { function HandlerOptions() {
this.activeNavTab = null; this.activeNavTab = null;
...@@ -48,19 +61,22 @@ cr.define('options', function() { ...@@ -48,19 +61,22 @@ cr.define('options', function() {
* @private * @private
*/ */
createHandlersList_: function() { createHandlersList_: function() {
this.handlersList_ = $('handlers-list'); var handlersList = $('handlers-list');
options.HandlersList.decorate(this.handlersList_); options.HandlersList.decorate(handlersList);
this.handlersList_ = assertInstanceof(handlersList, options.HandlersList);
this.handlersList_.autoExpands = true; this.handlersList_.autoExpands = true;
this.ignoredHandlersList_ = $('ignored-handlers-list'); var ignoredHandlersList = $('ignored-handlers-list');
options.IgnoredHandlersList.decorate(this.ignoredHandlersList_); options.IgnoredHandlersList.decorate(ignoredHandlersList);
this.ignoredHandlersList_ = assertInstanceof(ignoredHandlersList,
options.IgnoredHandlersList);
this.ignoredHandlersList_.autoExpands = true; this.ignoredHandlersList_.autoExpands = true;
}, },
}; };
/** /**
* Sets the list of handlers shown by the view. * Sets the list of handlers shown by the view.
* @param {Array} handlers Handlers to be shown in the view. * @param {Array.<Handlers>} handlers Handlers to be shown in the view.
*/ */
HandlerOptions.setHandlers = function(handlers) { HandlerOptions.setHandlers = function(handlers) {
$('handlers-list').setHandlers(handlers); $('handlers-list').setHandlers(handlers);
......
...@@ -17,7 +17,7 @@ cr.define('options', function() { ...@@ -17,7 +17,7 @@ cr.define('options', function() {
* @param {Object} entry A dictionary describing the handlers for a given * @param {Object} entry A dictionary describing the handlers for a given
* protocol. * protocol.
* @constructor * @constructor
* @extends {options.DeletableItemList} * @extends {options.DeletableItem}
*/ */
function IgnoredHandlersListItem(entry) { function IgnoredHandlersListItem(entry) {
var el = cr.doc.createElement('div'); var el = cr.doc.createElement('div');
...@@ -49,7 +49,10 @@ cr.define('options', function() { ...@@ -49,7 +49,10 @@ cr.define('options', function() {
}, },
}; };
/**
* @constructor
* @extends {options.DeletableItemList}
*/
var IgnoredHandlersList = cr.ui.define('list'); var IgnoredHandlersList = cr.ui.define('list');
IgnoredHandlersList.prototype = { IgnoredHandlersList.prototype = {
...@@ -82,8 +85,6 @@ cr.define('options', function() { ...@@ -82,8 +85,6 @@ cr.define('options', function() {
}, },
}; };
/** /**
* Creates a new protocol / content handler list item. * Creates a new protocol / content handler list item.
* *
...@@ -110,6 +111,11 @@ cr.define('options', function() { ...@@ -110,6 +111,11 @@ cr.define('options', function() {
HandlerListItem.prototype = { HandlerListItem.prototype = {
__proto__: ListItem.prototype, __proto__: ListItem.prototype,
/**
* @param {Handlers} data
* @param {{removeHandler: Function, setDefault: Function,
* clearDefault: Function}} delegate
*/
buildWidget_: function(data, delegate) { buildWidget_: function(data, delegate) {
// Protocol. // Protocol.
var protocolElement = document.createElement('div'); var protocolElement = document.createElement('div');
...@@ -223,7 +229,10 @@ cr.define('options', function() { ...@@ -223,7 +229,10 @@ cr.define('options', function() {
HandlersList.prototype = { HandlersList.prototype = {
__proto__: List.prototype, __proto__: List.prototype,
/** @override */ /**
* @override
* @param {Object} entry
*/
createItem: function(entry) { createItem: function(entry) {
return new HandlerListItem(entry); return new HandlerListItem(entry);
}, },
...@@ -239,7 +248,7 @@ cr.define('options', function() { ...@@ -239,7 +248,7 @@ cr.define('options', function() {
* Set the protocol handlers displayed by this list. * Set the protocol handlers displayed by this list.
* See HandlerListItem for an example of the format the list should take. * See HandlerListItem for an example of the format the list should take.
* *
* @param {Object} list A list of protocols with their registered handlers. * @param {!Array} list A list of protocols with their registered handlers.
*/ */
setHandlers: function(list) { setHandlers: function(list) {
this.dataModel = new ArrayDataModel(list); this.dataModel = new ArrayDataModel(list);
......
...@@ -16,7 +16,8 @@ cr.define('options', function() { ...@@ -16,7 +16,8 @@ cr.define('options', function() {
SettingsDialog.call(this, 'homePageOverlay', SettingsDialog.call(this, 'homePageOverlay',
loadTimeData.getString('homePageOverlayTabTitle'), loadTimeData.getString('homePageOverlayTabTitle'),
'home-page-overlay', 'home-page-overlay',
$('home-page-confirm'), $('home-page-cancel')); assertInstanceof($('home-page-confirm'), HTMLButtonElement),
assertInstanceof($('home-page-cancel'), HTMLButtonElement));
} }
cr.addSingletonGetter(HomePageOverlay); cr.addSingletonGetter(HomePageOverlay);
......
...@@ -22,8 +22,8 @@ cr.define('options', function() { ...@@ -22,8 +22,8 @@ cr.define('options', function() {
'hotwordConfim', // name 'hotwordConfim', // name
loadTimeData.getString('hotwordConfirmOverlayTabTitle'), loadTimeData.getString('hotwordConfirmOverlayTabTitle'),
'hotword-confirm-overlay', // pageDivName 'hotword-confirm-overlay', // pageDivName
$('hotword-confirm-ok'), // okButton assertInstanceof($('hotword-confirm-ok'), HTMLButtonElement),
$('hotword-confirm-cancel'), // cancelButton assertInstanceof($('hotword-confirm-cancel'), HTMLButtonElement),
$('hotword-search-enable')['pref'], // pref $('hotword-search-enable')['pref'], // pref
$('hotword-search-enable')['metric']); // metric $('hotword-search-enable')['metric']); // metric
......
...@@ -37,6 +37,11 @@ cr.define('options', function() { ...@@ -37,6 +37,11 @@ cr.define('options', function() {
// Create the language list with which users can add a language. // Create the language list with which users can add a language.
var addLanguageList = $('add-language-overlay-language-list'); var addLanguageList = $('add-language-overlay-language-list');
/**
* @type {Array.<{code: string, displayName: string,
* textDirection: string, nativeDisplayName: string}>}
* @see chrome/browser/ui/webui/options/language_options_handler.cc
*/
var languageListData = loadTimeData.getValue('languageList'); var languageListData = loadTimeData.getValue('languageList');
for (var i = 0; i < languageListData.length; i++) { for (var i = 0; i < languageListData.length; i++) {
var language = languageListData[i]; var language = languageListData[i];
......
...@@ -247,7 +247,7 @@ cr.define('options.passwordManager', function() { ...@@ -247,7 +247,7 @@ cr.define('options.passwordManager', function() {
/** /**
* Create a new passwords list. * Create a new passwords list.
* @constructor * @constructor
* @extends {cr.ui.List} * @extends {options.DeletableItemList}
*/ */
var PasswordsList = cr.ui.define('list'); var PasswordsList = cr.ui.define('list');
...@@ -279,7 +279,10 @@ cr.define('options.passwordManager', function() { ...@@ -279,7 +279,10 @@ cr.define('options.passwordManager', function() {
this.redraw(); this.redraw();
}, },
/** @override */ /**
* @override
* @param {Array} entry
*/
createItem: function(entry) { createItem: function(entry) {
var showPasswords = this.showPasswords_; var showPasswords = this.showPasswords_;
...@@ -317,7 +320,10 @@ cr.define('options.passwordManager', function() { ...@@ -317,7 +320,10 @@ cr.define('options.passwordManager', function() {
PasswordExceptionsList.prototype = { PasswordExceptionsList.prototype = {
__proto__: DeletableItemList.prototype, __proto__: DeletableItemList.prototype,
/** @override */ /**
* @override
* @param {Array} entry
*/
createItem: function(entry) { createItem: function(entry) {
return new PasswordExceptionsListItem(entry); return new PasswordExceptionsListItem(entry);
}, },
......
...@@ -155,7 +155,11 @@ cr.define('options', function() { ...@@ -155,7 +155,11 @@ cr.define('options', function() {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// PrefCheckbox class: // PrefCheckbox 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 {options.PrefInputElement}
*/
var PrefCheckbox = cr.ui.define('input'); var PrefCheckbox = cr.ui.define('input');
PrefCheckbox.prototype = { PrefCheckbox.prototype = {
...@@ -281,7 +285,11 @@ cr.define('options', function() { ...@@ -281,7 +285,11 @@ cr.define('options', function() {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// PrefRange class: // PrefRange 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 {options.PrefInputElement}
*/
var PrefRange = cr.ui.define('input'); var PrefRange = cr.ui.define('input');
PrefRange.prototype = { PrefRange.prototype = {
......
...@@ -116,7 +116,7 @@ cr.define('options', function() { ...@@ -116,7 +116,7 @@ cr.define('options', function() {
/** /**
* Updates the startup pages list with the given entries. * Updates the startup pages list with the given entries.
* @param {Array} pages List of startup pages. * @param {!Array} pages List of startup pages.
* @private * @private
*/ */
updateStartupPages_: function(pages) { updateStartupPages_: function(pages) {
......
...@@ -175,15 +175,9 @@ cr.define('options', function() { ...@@ -175,15 +175,9 @@ cr.define('options', function() {
/** /**
* Sets the data model of the supervised user list to |supervisedUsers|. * Sets the data model of the supervised user list to |supervisedUsers|.
* @param {Array.<Object>} supervisedUsers Array of supervised user objects. * @param {Array.<{id: string, name: string, iconURL: string,
* Each object is of the form: * onCurrentDevice: boolean, needAvatar: boolean}>} supervisedUsers
* supervisedUser = { * Array of supervised user objects.
* id: "Supervised User ID",
* name: "Supervised User Name",
* iconURL: "chrome://path/to/icon/image",
* onCurrentDevice: true or false,
* needAvatar: true or false
* }
* @private * @private
*/ */
receiveExistingSupervisedUsers_: function(supervisedUsers) { receiveExistingSupervisedUsers_: function(supervisedUsers) {
......
...@@ -106,6 +106,9 @@ void HandlerOptionsHandler::GetHandlersForProtocol( ...@@ -106,6 +106,9 @@ void HandlerOptionsHandler::GetHandlersForProtocol(
const std::string& protocol, const std::string& protocol,
base::DictionaryValue* handlers_value) { base::DictionaryValue* handlers_value) {
ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry();
// The items which are to be written into |handlers_value| are also described
// in chrome/browser/resources/options/handler_options.js in @typedef
// for Handlers. Please update them whenever you add or remove any keys here.
handlers_value->SetString("protocol", protocol); handlers_value->SetString("protocol", protocol);
handlers_value->SetInteger("default_handler", handlers_value->SetInteger("default_handler",
registry->GetHandlerIndex(protocol)); registry->GetHandlerIndex(protocol));
......
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