Commit d3759214 authored by Dan Beam's avatar Dan Beam

web_dev_style: now that object literal shorthands are allowed by styleguide, change:

prop: function(...) {

  to

prop() {

This CL changes this in: //components/

TBR=poromov@chromium.org

Bug: 1041171
Change-Id: I942b81decc9ad382a14b2c0aeeb53e96e9af4bac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2001400Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731699}
parent fec62b63
......@@ -280,7 +280,7 @@ function setInputElementValue_(value, input) {
if (overrideProperty) {
const newProperty = {
get: function() {
get() {
if (setterCalled && oldPropertyDescriptor.get) {
return oldPropertyDescriptor.get.call(input);
}
......
......@@ -428,7 +428,7 @@ FlagSearch.prototype = {
* Initialises the in page search. Adding searchbox listeners and
* collates the text elements used for string matching.
*/
init: function() {
init() {
this.experiments_.link = /** @type {!NodeList<!HTMLElement>} */ (
document.querySelectorAll('#tab-content-available .permalink'));
this.experiments_.title = /** @type {!NodeList<!HTMLElement>} */ (
......@@ -473,7 +473,7 @@ FlagSearch.prototype = {
/**
* Clears a search showing all experiments.
*/
clearSearch: function() {
clearSearch() {
this.searchBox_.value = '';
this.doSearch();
},
......@@ -483,7 +483,7 @@ FlagSearch.prototype = {
* @param {HTMLElement} el The element to remove all highlighted mark up on.
* @param {string} text Text to reset the element's textContent to.
*/
resetHighlights: function(el, text) {
resetHighlights(el, text) {
if (el.children) {
el.textContent = text;
}
......@@ -495,7 +495,7 @@ FlagSearch.prototype = {
* @param {HTMLElement} el The node containing the text to match against.
* @return {boolean} Whether there was a match.
*/
highlightMatchInElement: function(searchTerm, el) {
highlightMatchInElement(searchTerm, el) {
// Experiment container.
const parentEl = el.parentNode.parentNode.parentNode;
const text = el.textContent;
......@@ -543,7 +543,7 @@ FlagSearch.prototype = {
* @param {string} searchTerm
* @return {number} The number of matches found.
*/
highlightAllMatches: function(searchContent, searchTerm) {
highlightAllMatches(searchContent, searchTerm) {
let matches = 0;
for (let i = 0, j = searchContent.link.length; i < j; i++) {
if (this.highlightMatchInElement(searchTerm, searchContent.title[i])) {
......@@ -580,7 +580,7 @@ FlagSearch.prototype = {
/**
* Performs a search against the experiment title, description, permalink.
*/
doSearch: function() {
doSearch() {
const searchTerm = this.searchBox_.value.trim().toLowerCase();
if (searchTerm || searchTerm == '') {
......@@ -600,7 +600,7 @@ FlagSearch.prototype = {
this.searchIntervalId_ = null;
},
announceSearchResults: function() {
announceSearchResults() {
const searchTerm = this.searchBox_.value.trim().toLowerCase();
if (!searchTerm) {
return;
......@@ -628,7 +628,7 @@ FlagSearch.prototype = {
* Debounces the search to improve performance and prevent too many searches
* from being initiated.
*/
debounceSearch: function() {
debounceSearch() {
if (this.searchIntervalId_) {
clearTimeout(this.searchIntervalId_);
}
......
......@@ -56,7 +56,7 @@ const NetExportView = (function() {
/**
* Starts saving NetLog data to a file.
*/
onStartLogging_: function() {
onStartLogging_() {
// Determine the capture mode to use.
const logMode =
document.querySelector('input[name="log-mode"]:checked').value;
......@@ -77,14 +77,14 @@ const NetExportView = (function() {
/**
* Stops saving NetLog data to a file.
*/
onStopLogging_: function() {
onStopLogging_() {
chrome.send('stopNetLog');
},
/**
* Sends NetLog data via email from browser (mobile only).
*/
onSendEmail_: function() {
onSendEmail_() {
chrome.send('sendNetLog');
},
......@@ -92,14 +92,14 @@ const NetExportView = (function() {
* Reveals the log file in the shell (i.e. selects it in the Finder on
* Mac).
*/
onShowFile_: function() {
onShowFile_() {
chrome.send('showFile');
},
/**
* Transitions back to the "Start logging to disk" state.
*/
onStartOver_: function() {
onStartOver_() {
this.infoForLoggedFile_ = null;
this.renderInitial_();
},
......@@ -140,7 +140,7 @@ const NetExportView = (function() {
* finalized. Once the state transitions to NOT_LOGGING then the log
* is complete, and can safely be copied/emailed.
*/
onExportNetLogInfoChanged: function(info) {
onExportNetLogInfoChanged(info) {
switch (info.state) {
case 'UNINITIALIZED':
case 'INITIALIZING':
......@@ -190,7 +190,7 @@ const NetExportView = (function() {
* visible for a short period of time, or longer if initialization failed
* (and didn't transition to a different state).
*/
renderUninitialized_: function() {
renderUninitialized_() {
this.showStateDiv_(kIdStateDivUninitialized);
},
......@@ -199,7 +199,7 @@ const NetExportView = (function() {
* logging has not been started yet, and there are controls to start
* logging.
*/
renderInitial_: function() {
renderInitial_() {
this.showStateDiv_(kIdStateDivInitial);
$(kIdStartLoggingButton).onclick = this.onStartLogging_.bind(this);
},
......@@ -208,7 +208,7 @@ const NetExportView = (function() {
* Updates the UI to display the "logging" state. This is the state while
* capturing is in progress and being written to disk.
*/
renderLogging_: function(info) {
renderLogging_(info) {
this.showStateDiv_(kIdStateDivLogging);
$(kIdStopLoggingButton).onclick = this.onStopLogging_.bind(this);
......@@ -219,7 +219,7 @@ const NetExportView = (function() {
/*
* Updates the UI to display the state when logging has stopped.
*/
renderStoppedLogging_: function(info) {
renderStoppedLogging_(info) {
this.showStateDiv_(kIdStateDivStopped);
// The email button is only available in the mobile UI.
......@@ -250,7 +250,7 @@ const NetExportView = (function() {
/**
* Gets the textual label for a capture mode from the HTML.
*/
getCaptureModeText_: function(info) {
getCaptureModeText_(info) {
// TODO(eroman): Should not hardcode "Unknown" (will not work properly if
// the HTML is internationalized).
if (!info.logCaptureModeKnown) {
......@@ -265,17 +265,17 @@ const NetExportView = (function() {
return radioButton.parentElement.textContent;
},
showPrivacyReadMore_: function(show) {
showPrivacyReadMore_(show) {
$(kIdPrivacyReadMoreDiv).hidden = !show;
$(kIdPrivacyReadMoreLink).hidden = show;
},
showTooBigReadMore_: function(show) {
showTooBigReadMore_(show) {
$(kIdTooBigReadMoreDiv).hidden = !show;
$(kIdTooBigReadMoreLink).hidden = show;
},
showStateDiv_: function(divId) {
showStateDiv_(divId) {
const kAllDivIds = [
kIdStateDivUninitialized,
kIdStateDivInitial,
......
This diff is collapsed.
file://ui/webui/PLATFORM_OWNERS # For mechanical refactors.
......@@ -76,7 +76,7 @@ cr.define('policy', function() {
/**
* Initialization function for the cr.ui framework.
*/
decorate: function() {},
decorate() {},
/**
* Sets the text of a particular named label element in the status box
......@@ -87,7 +87,7 @@ cr.define('policy', function() {
* @param {boolean=} needsToBeShown True if we want to show the label
* False otherwise.
*/
setLabelAndShow_: function(labelName, labelValue, needsToBeShown = true) {
setLabelAndShow_(labelName, labelValue, needsToBeShown = true) {
const labelElement = this.querySelector(labelName);
labelElement.textContent = labelValue || '';
if (needsToBeShown) {
......@@ -100,7 +100,7 @@ cr.define('policy', function() {
* "user".
* @param {Object} status Dictionary with information about the status.
*/
initialize: function(scope, status) {
initialize(scope, status) {
const notSpecifiedString = loadTimeData.getString('notSpecified');
if (scope == 'device') {
// For device policy, set the appropriate title and populate the topmost
......@@ -188,7 +188,7 @@ cr.define('policy', function() {
// Set up the prototype chain.
__proto__: HTMLDivElement.prototype,
decorate: function() {},
decorate() {},
/** @param {Conflict} conflict */
initialize(conflict) {
......@@ -221,7 +221,7 @@ cr.define('policy', function() {
/**
* Initialization function for the cr.ui framework.
*/
decorate: function() {
decorate() {
const toggle = this.querySelector('.policy.row .toggle');
toggle.addEventListener('click', this.toggleExpanded_.bind(this));
},
......@@ -325,7 +325,7 @@ cr.define('policy', function() {
* Toggle the visibility of an additional row containing the complete text.
* @private
*/
toggleExpanded_: function() {
toggleExpanded_() {
const warningRowDisplay = this.querySelector('.warnings.row');
const errorRowDisplay = this.querySelector('.errors.row');
const valueRowDisplay = this.querySelector('.value.row');
......@@ -368,7 +368,7 @@ cr.define('policy', function() {
/**
* Initialization function for the cr.ui framework.
*/
decorate: function() {
decorate() {
this.policies_ = {};
this.filterPattern_ = '';
},
......@@ -413,7 +413,7 @@ cr.define('policy', function() {
* disabled by setting |pattern| to an empty string.
* @param {string} pattern The filter pattern.
*/
setFilterPattern: function(pattern) {
setFilterPattern(pattern) {
this.filterPattern_ = pattern.toLowerCase();
this.filter();
},
......@@ -423,7 +423,7 @@ cr.define('policy', function() {
* shown in the table. Furthermore, policies whose value is not currently
* set are only shown if the corresponding checkbox is checked.
*/
filter: function() {
filter() {
const showUnset = $('show-unset').checked;
const policies = this.querySelectorAll('.policy-data');
for (let i = 0; i < policies.length; i++) {
......@@ -451,7 +451,7 @@ cr.define('policy', function() {
/**
* Main initialization function. Called by the browser on page load.
*/
initialize: function() {
initialize() {
cr.ui.FocusOutlineManager.forDocument(document);
this.mainSection = $('main-section');
......@@ -545,7 +545,7 @@ cr.define('policy', function() {
* status.
* @param {Object} status Dictionary containing the current policy status.
*/
setStatus: function(status) {
setStatus(status) {
// Remove any existing status boxes.
const container = $('status-box-container');
while (container.firstChild) {
......@@ -569,7 +569,7 @@ cr.define('policy', function() {
* Re-enable the reload policies button when the previous request to reload
* policies values has completed.
*/
reloadPoliciesDone: function() {
reloadPoliciesDone() {
$('reload-policies').disabled = false;
},
};
......
......@@ -101,7 +101,7 @@
/**
* Finds the children of this node and appends them to the tree.
*/
handleExpand_: function(event) {
handleExpand_(event) {
const treeItem = this;
if (treeItem.expanded_) {
......@@ -133,13 +133,13 @@
SyncNodeTree.prototype = {
__proto__: cr.ui.Tree.prototype,
decorate: function() {
decorate() {
cr.ui.Tree.prototype.decorate.call(this);
this.addEventListener('change', this.handleChange_.bind(this));
this.allNodes = [];
},
populate: function(nodes) {
populate(nodes) {
const tree = this;
// We store the full set of nodes in the SyncNodeTree object.
......@@ -153,7 +153,7 @@
});
},
handleChange_: function(event) {
handleChange_(event) {
if (this.selectedItem) {
updateNodeDetailView(this.selectedItem);
}
......@@ -214,7 +214,7 @@
customSplitter.prototype = {
__proto__: Splitter.prototype,
handleSplitterDragEnd: function(e) {
handleSplitterDragEnd(e) {
Splitter.prototype.handleSplitterDragEnd.apply(this, arguments);
const treeElement = $('sync-node-tree-container');
const newWidth = parseFloat(treeElement.style.width);
......
......@@ -314,7 +314,7 @@ cr.googleTranslate = (function() {
* @return {boolean} False if the translate library was not ready, in which
* case the translation is not started. True otherwise.
*/
translate: function(originalLang, targetLang) {
translate(originalLang, targetLang) {
finished = false;
errorCode = ERROR['NONE'];
if (!libReady) {
......@@ -336,7 +336,7 @@ cr.googleTranslate = (function() {
* Reverts the page contents to its original value, effectively reverting
* any performed translation. Does nothing if the page was not translated.
*/
revert: function() {
revert() {
lib.restore();
},
......@@ -344,7 +344,7 @@ cr.googleTranslate = (function() {
* Called when an error is caught while executing script fetched in
* translate_script.cc.
*/
onTranslateElementError: function(error) {
onTranslateElementError(error) {
errorCode = ERROR['UNEXPECTED_SCRIPT_ERROR'];
invokeReadyCallback();
},
......@@ -353,7 +353,7 @@ cr.googleTranslate = (function() {
* Entry point called by the Translate Element once it has been injected in
* the page.
*/
onTranslateElementLoad: function() {
onTranslateElementLoad() {
loadedTime = performance.now();
try {
lib = google.translate.TranslateService({
......@@ -384,7 +384,7 @@ cr.googleTranslate = (function() {
* external CSS resource into the page.
* @param {string} url URL of an external CSS resource to load.
*/
onLoadCSS: function(url) {
onLoadCSS(url) {
const element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
......@@ -398,7 +398,7 @@ cr.googleTranslate = (function() {
* an external JavaScript on the page.
* @param {string} url URL of an external JavaScript to load.
*/
onLoadJavascript: function(url) {
onLoadJavascript(url) {
// securityOrigin is predefined by translate_script.cc.
if (!url.startsWith(securityOrigin)) {
console.error('Translate: ' + url + ' is not allowed to load.');
......
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