Commit df5e64aa authored by tsergeant's avatar tsergeant Committed by Commit bot

MD History: clang-format Javascript files (again!)

The clang-format Javascript style changed in crrev.com/440558 to prevent
single-line functions. This CL updates the Javascript in MD History to
follow this change.

BUG=567770
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2607653002
Cr-Commit-Position: refs/heads/master@{#440833}
parent 6ae3c143
...@@ -53,8 +53,12 @@ Polymer({ ...@@ -53,8 +53,12 @@ Polymer({
searchTerm: '', searchTerm: '',
groupedOffset: 0, groupedOffset: 0,
set range(val) { this._range = Number(val); }, set range(val) {
get range() { return this._range; }, this._range = Number(val);
},
get range() {
return this._range;
},
}; };
} }
}, },
...@@ -86,7 +90,9 @@ Polymer({ ...@@ -86,7 +90,9 @@ Polymer({
showMenuPromo_: { showMenuPromo_: {
type: Boolean, type: Boolean,
value: function() { return loadTimeData.getBoolean('showMenuPromo'); }, value: function() {
return loadTimeData.getBoolean('showMenuPromo');
},
}, },
// True if the window is narrow enough for the page to have a drawer. // True if the window is narrow enough for the page to have a drawer.
...@@ -164,7 +170,9 @@ Polymer({ ...@@ -164,7 +170,9 @@ Polymer({
}, },
/** @private */ /** @private */
onCrToolbarMenuPromoClose_: function() { this.showMenuPromo_ = false; }, onCrToolbarMenuPromoClose_: function() {
this.showMenuPromo_ = false;
},
/** @private */ /** @private */
onCrToolbarMenuPromoShown_: function() { onCrToolbarMenuPromoShown_: function() {
...@@ -211,7 +219,9 @@ Polymer({ ...@@ -211,7 +219,9 @@ Polymer({
toolbar.count = 0; toolbar.count = 0;
}, },
deleteSelected: function() { this.$.history.deleteSelectedWithPrompt(); }, deleteSelected: function() {
this.$.history.deleteSelectedWithPrompt();
},
/** /**
* @param {HistoryQuery} info An object containing information about the * @param {HistoryQuery} info An object containing information about the
...@@ -230,7 +240,9 @@ Polymer({ ...@@ -230,7 +240,9 @@ Polymer({
/** /**
* Shows and focuses the search bar in the toolbar. * Shows and focuses the search bar in the toolbar.
*/ */
focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); }, focusToolbarSearchField: function() {
this.$.toolbar.showSearchField();
},
/** /**
* @param {Event} e * @param {Event} e
...@@ -276,7 +288,9 @@ Polymer({ ...@@ -276,7 +288,9 @@ Polymer({
/** /**
* Called when browsing data is cleared. * Called when browsing data is cleared.
*/ */
historyDeleted: function() { this.$.history.historyDeleted(); }, historyDeleted: function() {
this.$.history.historyDeleted();
},
/** /**
* Update sign in state of synced device manager after user logs in or out. * Update sign in state of synced device manager after user logs in or out.
...@@ -353,7 +367,9 @@ Polymer({ ...@@ -353,7 +367,9 @@ Polymer({
* @return {string} * @return {string}
* @private * @private
*/ */
getSelectedPage_: function(selectedPage, items) { return selectedPage; }, getSelectedPage_: function(selectedPage, items) {
return selectedPage;
},
/** @private */ /** @private */
closeDrawer_: function() { closeDrawer_: function() {
......
...@@ -24,7 +24,9 @@ cr.define('md_history', function() { ...@@ -24,7 +24,9 @@ cr.define('md_history', function() {
deleteItems: function(items) { deleteItems: function(items) {
if (this.pendingDeleteItems_ != null) { if (this.pendingDeleteItems_ != null) {
// There's already a deletion in progress, reject immediately. // There's already a deletion in progress, reject immediately.
return new Promise(function(resolve, reject) { reject(items); }); return new Promise(function(resolve, reject) {
reject(items);
});
} }
var removalList = items.map(function(item) { var removalList = items.map(function(item) {
...@@ -45,7 +47,9 @@ cr.define('md_history', function() { ...@@ -45,7 +47,9 @@ cr.define('md_history', function() {
/** /**
* @param {!string} url * @param {!string} url
*/ */
removeBookmark: function(url) { chrome.send('removeBookmark', [url]); }, removeBookmark: function(url) {
chrome.send('removeBookmark', [url]);
},
/** /**
* @param {string} sessionTag * @param {string} sessionTag
...@@ -74,7 +78,9 @@ cr.define('md_history', function() { ...@@ -74,7 +78,9 @@ cr.define('md_history', function() {
chrome.send('deleteForeignSession', [sessionTag]); chrome.send('deleteForeignSession', [sessionTag]);
}, },
openClearBrowsingData: function() { chrome.send('clearBrowsingData'); }, openClearBrowsingData: function() {
chrome.send('clearBrowsingData');
},
/** /**
* @param {string} histogram * @param {string} histogram
...@@ -114,7 +120,9 @@ cr.define('md_history', function() { ...@@ -114,7 +120,9 @@ cr.define('md_history', function() {
this.pendingDeletePromise_ = null; this.pendingDeletePromise_ = null;
}, },
menuPromoShown: function() { chrome.send('menuPromoShown'); }, menuPromoShown: function() {
chrome.send('menuPromoShown');
},
}; };
cr.addSingletonGetter(BrowserService); cr.addSingletonGetter(BrowserService);
......
...@@ -139,7 +139,9 @@ Polymer({ ...@@ -139,7 +139,9 @@ Polymer({
e.model.set('domain.rendered', true); e.model.set('domain.rendered', true);
// Give the history-items time to render. // Give the history-items time to render.
setTimeout(function() { collapse.toggle() }, 0); setTimeout(function() {
collapse.toggle()
}, 0);
}, },
/** /**
......
...@@ -233,7 +233,9 @@ cr.define('md_history', function() { ...@@ -233,7 +233,9 @@ cr.define('md_history', function() {
* @return {string} * @return {string}
* @private * @private
*/ */
getAriaChecked_: function(selected) { return selected ? 'true' : 'false'; }, getAriaChecked_: function(selected) {
return selected ? 'true' : 'false';
},
/** /**
* Remove bookmark of current item when bookmark-star is clicked. * Remove bookmark of current item when bookmark-star is clicked.
......
...@@ -155,5 +155,7 @@ Polymer({ ...@@ -155,5 +155,7 @@ Polymer({
* @return {string} * @return {string}
* @private * @private
*/ */
pathForItem_: function(index) { return 'historyData_.' + index; }, pathForItem_: function(index) {
return 'historyData_.' + index;
},
}); });
...@@ -35,7 +35,9 @@ var HistoryListBehavior = { ...@@ -35,7 +35,9 @@ var HistoryListBehavior = {
*/ */
selectedPaths: { selectedPaths: {
type: Object, type: Object,
value: /** @return {!Set<string>} */ function() { return new Set(); }, value: /** @return {!Set<string>} */ function() {
return new Set();
},
}, },
lastSelectedPath: String, lastSelectedPath: String,
...@@ -59,7 +61,9 @@ var HistoryListBehavior = { ...@@ -59,7 +61,9 @@ var HistoryListBehavior = {
* @return {boolean} * @return {boolean}
* @private * @private
*/ */
hasResults: function(historyDataLength) { return historyDataLength > 0; }, hasResults: function(historyDataLength) {
return historyDataLength > 0;
},
/** /**
* @param {string} searchedTerm * @param {string} searchedTerm
...@@ -170,7 +174,9 @@ var HistoryListBehavior = { ...@@ -170,7 +174,9 @@ var HistoryListBehavior = {
var array = this.get(node.currentPath); var array = this.get(node.currentPath);
var splices = []; var splices = [];
node.indexes.sort(function(a, b) { return b - a; }); node.indexes.sort(function(a, b) {
return b - a;
});
node.indexes.forEach(function(index) { node.indexes.forEach(function(index) {
if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) { if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) {
var item = array.splice(index, 1)[0]; var item = array.splice(index, 1)[0];
......
...@@ -83,14 +83,18 @@ Polymer({ ...@@ -83,14 +83,18 @@ Polymer({
.getSearchField(); .getSearchField();
}, },
showSearchField: function() { this.searchField.showAndFocus(); }, showSearchField: function() {
this.searchField.showAndFocus();
},
/** /**
* Changes the toolbar background color depending on whether any history items * Changes the toolbar background color depending on whether any history items
* are currently selected. * are currently selected.
* @private * @private
*/ */
changeToolbarView_: function() { this.itemsSelected_ = this.count > 0; }, changeToolbarView_: function() {
this.itemsSelected_ = this.count > 0;
},
/** /**
* When changing the search term externally, update the search field to * When changing the search term externally, update the search field to
...@@ -123,10 +127,14 @@ Polymer({ ...@@ -123,10 +127,14 @@ Polymer({
}, },
/** @private */ /** @private */
onClearSelectionTap_: function() { this.fire('unselect-all'); }, onClearSelectionTap_: function() {
this.fire('unselect-all');
},
/** @private */ /** @private */
onDeleteTap_: function() { this.fire('delete-selected'); }, onDeleteTap_: function() {
this.fire('delete-selected');
},
/** /**
* If the user is a supervised user the delete button is not shown. * If the user is a supervised user the delete button is not shown.
...@@ -170,5 +178,7 @@ Polymer({ ...@@ -170,5 +178,7 @@ Polymer({
* @private * @private
* @return {boolean} * @return {boolean}
*/ */
isToday_: function() { return this.groupedOffset == 0; }, isToday_: function() {
return this.groupedOffset == 0;
},
}); });
...@@ -114,7 +114,9 @@ Polymer({ ...@@ -114,7 +114,9 @@ Polymer({
}, },
/** @return {Element} */ /** @return {Element} */
getContentScrollTarget: function() { return this.getSelectedList_(); }, getContentScrollTarget: function() {
return this.getSelectedList_();
},
/** @return {number} */ /** @return {number} */
getSelectedItemCount: function() { getSelectedItemCount: function() {
...@@ -178,10 +180,14 @@ Polymer({ ...@@ -178,10 +180,14 @@ Polymer({
}, },
/** @private */ /** @private */
groupedOffsetChanged_: function() { this.queryHistory(false); }, groupedOffsetChanged_: function() {
this.queryHistory(false);
},
/** @private */ /** @private */
loadMoreHistory_: function() { this.queryHistory(true); }, loadMoreHistory_: function() {
this.queryHistory(true);
},
/** /**
* @param {HistoryQuery} info * @param {HistoryQuery} info
...@@ -299,7 +305,9 @@ Polymer({ ...@@ -299,7 +305,9 @@ Polymer({
* @return {Element} * @return {Element}
* @private * @private
*/ */
getSelectedList_: function() { return this.$$('#' + this.selectedPage_); }, getSelectedList_: function() {
return this.$$('#' + this.selectedPage_);
},
/** @private */ /** @private */
canDeleteHistory_: function() { canDeleteHistory_: function() {
......
...@@ -30,12 +30,16 @@ Polymer({ ...@@ -30,12 +30,16 @@ Polymer({
* @param {CustomEvent} e * @param {CustomEvent} e
* @private * @private
*/ */
onSpacePressed_: function(e) { e.detail.keyboardEvent.path[0].click(); }, onSpacePressed_: function(e) {
e.detail.keyboardEvent.path[0].click();
},
/** /**
* @private * @private
*/ */
onSelectorActivate_: function() { this.fire('history-close-drawer'); }, onSelectorActivate_: function() {
this.fire('history-close-drawer');
},
/** /**
* Relocates the user to the clear browsing data section of the settings page. * Relocates the user to the clear browsing data section of the settings page.
...@@ -55,5 +59,7 @@ Polymer({ ...@@ -55,5 +59,7 @@ Polymer({
* accessibility purposes, taps are handled separately by <iron-selector>. * accessibility purposes, taps are handled separately by <iron-selector>.
* @private * @private
*/ */
onItemClick_: function(e) { e.preventDefault(); }, onItemClick_: function(e) {
e.preventDefault();
},
}); });
...@@ -12,7 +12,9 @@ Polymer({ ...@@ -12,7 +12,9 @@ Polymer({
*/ */
tabs: { tabs: {
type: Array, type: Array,
value: function() { return []; }, value: function() {
return [];
},
observer: 'updateIcons_' observer: 'updateIcons_'
}, },
......
...@@ -36,7 +36,9 @@ Polymer({ ...@@ -36,7 +36,9 @@ Polymer({
*/ */
syncedDevices_: { syncedDevices_: {
type: Array, type: Array,
value: function() { return []; }, value: function() {
return [];
},
}, },
/** @private */ /** @private */
...@@ -87,10 +89,14 @@ Polymer({ ...@@ -87,10 +89,14 @@ Polymer({
}, },
/** @override */ /** @override */
detached: function() { this.focusGrid_.destroy(); }, detached: function() {
this.focusGrid_.destroy();
},
/** @return {HTMLElement} */ /** @return {HTMLElement} */
getContentScrollTarget: function() { return this; }, getContentScrollTarget: function() {
return this;
},
/** /**
* @param {!ForeignSession} session * @param {!ForeignSession} session
...@@ -106,7 +112,9 @@ Polymer({ ...@@ -106,7 +112,9 @@ Polymer({
if (newTabs.length == 0) if (newTabs.length == 0)
continue; continue;
newTabs.forEach(function(tab) { tab.windowId = windowId; }); newTabs.forEach(function(tab) {
tab.windowId = windowId;
});
var windowAdded = false; var windowAdded = false;
if (!this.searchTerm) { if (!this.searchTerm) {
...@@ -138,7 +146,9 @@ Polymer({ ...@@ -138,7 +146,9 @@ Polymer({
}, },
/** @private */ /** @private */
onSignInTap_: function() { chrome.send('startSignInFlow'); }, onSignInTap_: function() {
chrome.send('startSignInFlow');
},
/** @private */ /** @private */
onOpenMenu_: function(e) { onOpenMenu_: function(e) {
...@@ -177,7 +187,9 @@ Polymer({ ...@@ -177,7 +187,9 @@ Polymer({
return prev.concat(cur.createFocusRows()); return prev.concat(cur.createFocusRows());
}, },
[]) [])
.forEach(function(row) { this.focusGrid_.addRow(row); }.bind(this)); .forEach(function(row) {
this.focusGrid_.addRow(row);
}.bind(this));
this.focusGrid_.ensureRowActive(); this.focusGrid_.ensureRowActive();
}); });
}, },
...@@ -195,7 +207,9 @@ Polymer({ ...@@ -195,7 +207,9 @@ Polymer({
}, },
/** @private */ /** @private */
clearDisplayedSyncedDevices_: function() { this.syncedDevices_ = []; }, clearDisplayedSyncedDevices_: function() {
this.syncedDevices_ = [];
},
/** /**
* Decide whether or not should display no synced tabs message. * Decide whether or not should display no synced tabs message.
......
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