Skip to content

Commit

Permalink
web_dev_style: now that object literal shorthands are allowed by styl…
Browse files Browse the repository at this point in the history
…eguide, change:

  prop: function(...) {

to

  prop() {

This CL changes this in: //chrome/browser/resources/

Bug: 1041171
Change-Id: I2508dd37aa6143f1b823c5e009f36b0924952afe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996132
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731098}
  • Loading branch information
danbeam authored and Commit Bot committed Jan 14, 2020
1 parent b69a30f commit a5cfc5f
Show file tree
Hide file tree
Showing 596 changed files with 6,547 additions and 6,588 deletions.
8 changes: 4 additions & 4 deletions chrome/browser/resources/app_management/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Polymer({
/**
* @override
*/
attached: function() {
attached() {
this.watch('searchTerm_', function(state) {
return state.search.term;
});
Expand All @@ -43,15 +43,15 @@ Polymer({


/** @private */
onSearchTermChanged_: function() {
onSearchTermChanged_() {
this.searchField.setValue(this.searchTerm_ || '');
},

/**
* @param {Event} e
* @private
*/
onSearchChanged_: function(e) {
onSearchChanged_(e) {
const searchTerm = /** @type {string} */ (e.detail);
if (searchTerm != this.searchTerm_) {
this.dispatch(app_management.actions.setSearchTerm(searchTerm));
Expand All @@ -63,7 +63,7 @@ Polymer({
* @param {String} searchTerm
* @private
*/
selectedRouteId_: function(currentPage, searchTerm) {
selectedRouteId_(currentPage, searchTerm) {
if (searchTerm) {
return 'search-view';
}
Expand Down
12 changes: 6 additions & 6 deletions chrome/browser/resources/app_management/expandable_app_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ Polymer({
'dom-change': 'onDomChange_',
},

attached: function() {
attached() {
// Hide on reattach.
this.listExpanded_ = false;
this.$.collapse.hide();
},

/** @private */
onAppsChanged_: function(change) {},
onAppsChanged_(change) {},

/** @private */
onListTitleChanged_() {
this.$['app-list-title'].hidden = !this.listTitle;
},

/** @private */
onDomChange_: function() {
onDomChange_() {
let collapsedHeight = 0;
let numChildren = 0;
for (const child of this.$.collapse.getContentChildren()) {
Expand All @@ -92,7 +92,7 @@ Polymer({
},

/** @private */
toggleListExpanded_: function() {
toggleListExpanded_() {
this.listExpanded_ = !this.listExpanded_;
},

Expand All @@ -118,7 +118,7 @@ Polymer({
* @return {string}
* @private
*/
getCollapsedIcon_: function(listExpanded) {
getCollapsedIcon_(listExpanded) {
return listExpanded ? 'cr:expand-less' : 'cr:expand-more';
},

Expand All @@ -128,7 +128,7 @@ Polymer({
* @return {string}
* @private
*/
moreAppsString_: function(numApps, listExpanded) {
moreAppsString_(numApps, listExpanded) {
return listExpanded ?
loadTimeData.getString('lessApps') :
loadTimeData.getStringF('moreApps', numApps - this.collapsedSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cr.define('bluetooth_internals', function() {
PageObserver.prototype = {
__proto__: PageManager.Observer.prototype,

updateHistory: function(path) {
updateHistory(path) {
window.location.hash = '#' + path;
},

Expand All @@ -62,7 +62,7 @@ cr.define('bluetooth_internals', function() {
* @override
* @param {string} title
*/
updateTitle: function(title) {
updateTitle(title) {
document.querySelector('.page-title').textContent = title;
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ cr.define('characteristic_list', function() {
* two fieldsets for displaying property values.
* @override
*/
decorate: function() {
decorate() {
this.classList.add('characteristic-list-item');

/** @private {!object_fieldset.ObjectFieldSet} */
Expand Down Expand Up @@ -187,7 +187,7 @@ cr.define('characteristic_list', function() {
},

/** @override */
onExpandInternal: function(expanded) {
onExpandInternal(expanded) {
this.descriptorList_.load(
this.deviceAddress_, this.serviceId_, this.info.id);
},
Expand All @@ -204,7 +204,7 @@ cr.define('characteristic_list', function() {
__proto__: ExpandableList.prototype,

/** @override */
decorate: function() {
decorate() {
ExpandableList.prototype.decorate.call(this);

/** @private {?string} */
Expand All @@ -218,7 +218,7 @@ cr.define('characteristic_list', function() {
this.setEmptyMessage('No Characteristics Found');
},

createItem: function(data) {
createItem(data) {
return new CharacteristicListItem(
data, assert(this.deviceAddress_), assert(this.serviceId_));
},
Expand All @@ -230,7 +230,7 @@ cr.define('characteristic_list', function() {
* @param {string} deviceAddress
* @param {string} serviceId
*/
load: function(deviceAddress, serviceId) {
load(deviceAddress, serviceId) {
if (this.characteristicsRequested_ || !this.isSpinnerShowing()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cr.define('descriptor_list', function() {
* a fieldset for displaying property values.
* @override
*/
decorate: function() {
decorate() {
this.classList.add('descriptor-list-item');

/** @private {!object_fieldset.ObjectFieldSet} */
Expand Down Expand Up @@ -122,7 +122,7 @@ cr.define('descriptor_list', function() {
__proto__: ExpandableList.prototype,

/** @override */
decorate: function() {
decorate() {
ExpandableList.prototype.decorate.call(this);

/** @private {?string} */
Expand All @@ -138,7 +138,7 @@ cr.define('descriptor_list', function() {
this.setEmptyMessage('No Descriptors Found');
},

createItem: function(data) {
createItem(data) {
return new DescriptorListItem(
data, assert(this.deviceAddress_), assert(this.serviceId_),
assert(this.characteristicId_));
Expand All @@ -153,7 +153,7 @@ cr.define('descriptor_list', function() {
* @param {string} serviceId
* @param {string} characteristicId
*/
load: function(deviceAddress, serviceId, characteristicId) {
load(deviceAddress, serviceId, characteristicId) {
if (this.descriptorsRequested_ || !this.isSpinnerShowing()) {
return;
}
Expand Down
20 changes: 10 additions & 10 deletions chrome/browser/resources/bluetooth_internals/device_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cr.define('device_table', function() {
* Decorates an element as a UI element class. Caches references to the
* table body and headers.
*/
decorate: function() {
decorate() {
/** @private */
this.body_ = this.tBodies[0];
/** @private */
Expand All @@ -51,7 +51,7 @@ cr.define('device_table', function() {
* Sets the tables device collection.
* @param {!device_collection.DeviceCollection} deviceCollection
*/
setDevices: function(deviceCollection) {
setDevices(deviceCollection) {
assert(!this.devices_, 'Devices can only be set once.');

this.devices_ = deviceCollection;
Expand All @@ -69,7 +69,7 @@ cr.define('device_table', function() {
* @param {!bluetooth.mojom.DeviceInfo} deviceInfo
* @param {boolean} isInspecting
*/
setInspecting: function(deviceInfo, isInspecting) {
setInspecting(deviceInfo, isInspecting) {
this.inspectionMap_.set(deviceInfo, isInspecting);
this.updateRow_(deviceInfo, this.devices_.indexOf(deviceInfo));
},
Expand All @@ -79,7 +79,7 @@ cr.define('device_table', function() {
* @param {number} index
* @private
*/
handleForgetClick_: function(index) {
handleForgetClick_(index) {
const event = new CustomEvent('forgetpressed', {
bubbles: true,
detail: {
Expand All @@ -94,7 +94,7 @@ cr.define('device_table', function() {
* @param {!Event} event
* @private
*/
handleChange_: function(event) {
handleChange_(event) {
this.updateRow_(this.devices_.item(event.index), event.index);
},

Expand All @@ -103,7 +103,7 @@ cr.define('device_table', function() {
* @param {number} index
* @private
*/
handleInspectClick_: function(index) {
handleInspectClick_(index) {
const event = new CustomEvent('inspectpressed', {
bubbles: true,
detail: {
Expand All @@ -118,7 +118,7 @@ cr.define('device_table', function() {
* @param {!Event} event
* @private
*/
handleSplice_: function(event) {
handleSplice_(event) {
event.removed.forEach(function() {
this.body_.deleteRow(event.index);
}, this);
Expand All @@ -134,7 +134,7 @@ cr.define('device_table', function() {
* @param {?number} index
* @private
*/
insertRow_: function(device, index) {
insertRow_(device, index) {
const row = this.body_.insertRow(index);
row.id = device.address;

Expand Down Expand Up @@ -170,7 +170,7 @@ cr.define('device_table', function() {
* Deletes and recreates the table using the cached |devices_|.
* @private
*/
redraw_: function() {
redraw_() {
this.removeChild(this.body_);
this.appendChild(document.createElement('tbody'));
this.body_ = this.tBodies[0];
Expand All @@ -187,7 +187,7 @@ cr.define('device_table', function() {
* @param {number} index
* @private
*/
updateRow_: function(device, index) {
updateRow_(device, index) {
const row = this.body_.rows[index];
assert(row, 'Row ' + index + ' is not in the table.');

Expand Down
18 changes: 9 additions & 9 deletions chrome/browser/resources/bluetooth_internals/expandable_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cr.define('expandable_list', function() {
* content holders for implementations.
* @override
*/
decorate: function() {
decorate() {
this.classList.add('expandable-list-item');
this.briefContent_ = document.createElement('div');
this.briefContent_.classList.add('brief-content');
Expand All @@ -43,13 +43,13 @@ cr.define('expandable_list', function() {
* Called when the list item is expanded or collapsed.
* @param {boolean} expanded
*/
onExpandInternal: function(expanded) {},
onExpandInternal(expanded) {},

/**
* Toggles the expanded class on the item.
* @private
*/
onExpand_: function() {
onExpand_() {
this.onExpandInternal(this.classList.toggle('expanded'));
},
};
Expand All @@ -69,7 +69,7 @@ cr.define('expandable_list', function() {
* elements.
* @override
*/
decorate: function() {
decorate() {
List.prototype.decorate.call(this);
this.classList.add('expandable-list');

Expand All @@ -91,7 +91,7 @@ cr.define('expandable_list', function() {
* Sets the data model of the list.
* @param {cr.ui.ArrayDataModel} data
*/
setData: function(data) {
setData(data) {
if (this.dataModel) {
this.dataModel.removeEventListener('splice', this.boundUpdateMessage_);
}
Expand All @@ -105,7 +105,7 @@ cr.define('expandable_list', function() {
* Sets the empty message text.
* @param {string} message
*/
setEmptyMessage: function(message) {
setEmptyMessage(message) {
this.emptyMessage_.textContent = message;
},

Expand All @@ -114,23 +114,23 @@ cr.define('expandable_list', function() {
* spinner is dispayed.
* @param {boolean} showing
*/
setSpinnerShowing: function(showing) {
setSpinnerShowing(showing) {
this.spinner_.hidden = !showing;
},

/**
* Gets the spinner display state. Returns true if the spinner is showing.
* @return {boolean}
*/
isSpinnerShowing: function() {
isSpinnerShowing() {
return !this.spinner_.hidden;
},

/**
* Updates the display state of the empty message. If there are no items in
* the data model, the empty message is displayed.
*/
updateMessageDisplay_: function() {
updateMessageDisplay_() {
this.emptyMessage_.hidden = this.dataModel.length > 0;
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cr.define('object_fieldset', function() {
/**
* Decorates the element as an ObjectFieldset.
*/
decorate: function() {
decorate() {
this.classList.add('object-fieldset');

/** @type {?Object} */
Expand All @@ -51,7 +51,7 @@ cr.define('object_fieldset', function() {
* Sets the object data to be displayed in the fieldset.
* @param {!Object} value
*/
setObject: function(value) {
setObject(value) {
this.value = value;
this.redraw();
},
Expand All @@ -61,14 +61,14 @@ cr.define('object_fieldset', function() {
* name is not provided, the default property name will be used.
* @param {!Object<string, string>} nameMap
*/
setPropertyDisplayNames: function(nameMap) {
setPropertyDisplayNames(nameMap) {
this.nameMap_ = nameMap;
},

/**
* Deletes and recreates the table structure with current object data.
*/
redraw: function() {
redraw() {
this.innerHTML = '';

Object.keys(assert(this.value)).forEach(function(propName) {
Expand Down
Loading

0 comments on commit a5cfc5f

Please sign in to comment.