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() {
* @param {string} name See Page constructor.
* @param {string} title See Page constructor.
* @param {string} pageDivName See Page constructor.
* @param {HTMLInputElement} okButton The confirmation button element.
* @param {HTMLInputElement} cancelButton The cancellation button element.
* @param {HTMLButtonElement} okButton The confirmation button element.
* @param {HTMLButtonElement} cancelButton The cancellation button element.
* @param {string} pref The pref that requires confirmation.
* @param {string} metric User metrics identifier.
* @param {string=} opt_confirmedPref A pref used to remember whether the
......
......@@ -2,6 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// 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() {
/** @const */ var Page = cr.ui.pageManager.Page;
/** @const */ var PageManager = cr.ui.pageManager.PageManager;
......@@ -12,6 +24,7 @@ cr.define('options', function() {
/**
* Encapsulated handling of handler options page.
* @constructor
* @extends {cr.ui.pageManager.Page}
*/
function HandlerOptions() {
this.activeNavTab = null;
......@@ -48,19 +61,22 @@ cr.define('options', function() {
* @private
*/
createHandlersList_: function() {
this.handlersList_ = $('handlers-list');
options.HandlersList.decorate(this.handlersList_);
var handlersList = $('handlers-list');
options.HandlersList.decorate(handlersList);
this.handlersList_ = assertInstanceof(handlersList, options.HandlersList);
this.handlersList_.autoExpands = true;
this.ignoredHandlersList_ = $('ignored-handlers-list');
options.IgnoredHandlersList.decorate(this.ignoredHandlersList_);
var ignoredHandlersList = $('ignored-handlers-list');
options.IgnoredHandlersList.decorate(ignoredHandlersList);
this.ignoredHandlersList_ = assertInstanceof(ignoredHandlersList,
options.IgnoredHandlersList);
this.ignoredHandlersList_.autoExpands = true;
},
};
/**
* 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) {
$('handlers-list').setHandlers(handlers);
......
......@@ -17,7 +17,7 @@ cr.define('options', function() {
* @param {Object} entry A dictionary describing the handlers for a given
* protocol.
* @constructor
* @extends {options.DeletableItemList}
* @extends {options.DeletableItem}
*/
function IgnoredHandlersListItem(entry) {
var el = cr.doc.createElement('div');
......@@ -49,7 +49,10 @@ cr.define('options', function() {
},
};
/**
* @constructor
* @extends {options.DeletableItemList}
*/
var IgnoredHandlersList = cr.ui.define('list');
IgnoredHandlersList.prototype = {
......@@ -82,8 +85,6 @@ cr.define('options', function() {
},
};
/**
* Creates a new protocol / content handler list item.
*
......@@ -110,6 +111,11 @@ cr.define('options', function() {
HandlerListItem.prototype = {
__proto__: ListItem.prototype,
/**
* @param {Handlers} data
* @param {{removeHandler: Function, setDefault: Function,
* clearDefault: Function}} delegate
*/
buildWidget_: function(data, delegate) {
// Protocol.
var protocolElement = document.createElement('div');
......@@ -223,7 +229,10 @@ cr.define('options', function() {
HandlersList.prototype = {
__proto__: List.prototype,
/** @override */
/**
* @override
* @param {Object} entry
*/
createItem: function(entry) {
return new HandlerListItem(entry);
},
......@@ -239,7 +248,7 @@ cr.define('options', function() {
* Set the protocol handlers displayed by this list.
* 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) {
this.dataModel = new ArrayDataModel(list);
......
......@@ -14,9 +14,10 @@ cr.define('options', function() {
*/
function HomePageOverlay() {
SettingsDialog.call(this, 'homePageOverlay',
loadTimeData.getString('homePageOverlayTabTitle'),
'home-page-overlay',
$('home-page-confirm'), $('home-page-cancel'));
loadTimeData.getString('homePageOverlayTabTitle'),
'home-page-overlay',
assertInstanceof($('home-page-confirm'), HTMLButtonElement),
assertInstanceof($('home-page-cancel'), HTMLButtonElement));
}
cr.addSingletonGetter(HomePageOverlay);
......
......@@ -19,13 +19,13 @@ cr.define('options', function() {
*/
function HotwordConfirmDialog() {
ConfirmDialog.call(this,
'hotwordConfim', // name
loadTimeData.getString('hotwordConfirmOverlayTabTitle'),
'hotword-confirm-overlay', // pageDivName
$('hotword-confirm-ok'), // okButton
$('hotword-confirm-cancel'), // cancelButton
$('hotword-search-enable')['pref'], // pref
$('hotword-search-enable')['metric']); // metric
'hotwordConfim', // name
loadTimeData.getString('hotwordConfirmOverlayTabTitle'),
'hotword-confirm-overlay', // pageDivName
assertInstanceof($('hotword-confirm-ok'), HTMLButtonElement),
assertInstanceof($('hotword-confirm-cancel'), HTMLButtonElement),
$('hotword-search-enable')['pref'], // pref
$('hotword-search-enable')['metric']); // metric
this.indicator = $('hotword-search-setting-indicator');
}
......
......@@ -37,6 +37,11 @@ cr.define('options', function() {
// Create the language list with which users can add a language.
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');
for (var i = 0; i < languageListData.length; i++) {
var language = languageListData[i];
......
......@@ -247,7 +247,7 @@ cr.define('options.passwordManager', function() {
/**
* Create a new passwords list.
* @constructor
* @extends {cr.ui.List}
* @extends {options.DeletableItemList}
*/
var PasswordsList = cr.ui.define('list');
......@@ -279,7 +279,10 @@ cr.define('options.passwordManager', function() {
this.redraw();
},
/** @override */
/**
* @override
* @param {Array} entry
*/
createItem: function(entry) {
var showPasswords = this.showPasswords_;
......@@ -317,7 +320,10 @@ cr.define('options.passwordManager', function() {
PasswordExceptionsList.prototype = {
__proto__: DeletableItemList.prototype,
/** @override */
/**
* @override
* @param {Array} entry
*/
createItem: function(entry) {
return new PasswordExceptionsListItem(entry);
},
......
......@@ -155,7 +155,11 @@ cr.define('options', function() {
/////////////////////////////////////////////////////////////////////////////
// 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');
PrefCheckbox.prototype = {
......@@ -281,7 +285,11 @@ cr.define('options', function() {
/////////////////////////////////////////////////////////////////////////////
// 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');
PrefRange.prototype = {
......
......@@ -116,7 +116,7 @@ cr.define('options', function() {
/**
* Updates the startup pages list with the given entries.
* @param {Array} pages List of startup pages.
* @param {!Array} pages List of startup pages.
* @private
*/
updateStartupPages_: function(pages) {
......
......@@ -175,15 +175,9 @@ cr.define('options', function() {
/**
* Sets the data model of the supervised user list to |supervisedUsers|.
* @param {Array.<Object>} supervisedUsers Array of supervised user objects.
* Each object is of the form:
* supervisedUser = {
* id: "Supervised User ID",
* name: "Supervised User Name",
* iconURL: "chrome://path/to/icon/image",
* onCurrentDevice: true or false,
* needAvatar: true or false
* }
* @param {Array.<{id: string, name: string, iconURL: string,
* onCurrentDevice: boolean, needAvatar: boolean}>} supervisedUsers
* Array of supervised user objects.
* @private
*/
receiveExistingSupervisedUsers_: function(supervisedUsers) {
......
......@@ -106,6 +106,9 @@ void HandlerOptionsHandler::GetHandlersForProtocol(
const std::string& protocol,
base::DictionaryValue* handlers_value) {
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->SetInteger("default_handler",
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