MD Extensions: Convert all usages of .bind(this) to use ES6 arrow function.
Bug: 747596 Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation Change-Id: Iec0f19f471edbf80309071baacd96d7bf8351ef1 Reviewed-on: https://chromium-review.googlesource.com/585846 Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org> Reviewed-by: Scott Chen <scottchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#490113}
This commit is contained in:
.eslintrc.js
chrome/browser/resources/md_extensions
@ -21,7 +21,6 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
'semi': ['error', 'always'],
|
||||
'arrow-parens': ['error', 'always'],
|
||||
|
||||
// TODO(dpapad): Add more checks according to our styleguide.
|
||||
},
|
||||
|
@ -12,12 +12,12 @@ Polymer({
|
||||
var dragTarget = document.documentElement;
|
||||
this.dragWrapperHandler_ =
|
||||
new extensions.DragAndDropHandler(true, dragTarget);
|
||||
dragTarget.addEventListener('extension-drag-started', function() {
|
||||
dragTarget.addEventListener('extension-drag-started', () => {
|
||||
this.hidden = false;
|
||||
}.bind(this));
|
||||
dragTarget.addEventListener('extension-drag-ended', function() {
|
||||
});
|
||||
dragTarget.addEventListener('extension-drag-ended', () => {
|
||||
this.hidden = true;
|
||||
}.bind(this));
|
||||
});
|
||||
this.dragWrapper_ =
|
||||
new cr.ui.DragWrapper(dragTarget, this.dragWrapperHandler_);
|
||||
},
|
||||
|
@ -138,9 +138,9 @@ cr.define('extensions', function() {
|
||||
0;
|
||||
break;
|
||||
}
|
||||
this.delegate.requestFileSource(args).then(function(code) {
|
||||
this.delegate.requestFileSource(args).then(code => {
|
||||
this.$['code-section'].code = code;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -129,11 +129,10 @@ cr.define('extensions', function() {
|
||||
this.sidebar.setListDelegate(this.listHelper_);
|
||||
this.readyPromiseResolver.resolve();
|
||||
this.currentPage_ = {page: Page.LIST};
|
||||
this.navigationHelper_ =
|
||||
new extensions.NavigationHelper(function(newPage) {
|
||||
this.changePage(newPage, true);
|
||||
}.bind(this));
|
||||
this.optionsDialog.addEventListener('close', function() {
|
||||
this.navigationHelper_ = new extensions.NavigationHelper(newPage => {
|
||||
this.changePage(newPage, true);
|
||||
});
|
||||
this.optionsDialog.addEventListener('close', () => {
|
||||
// We update the page when the options dialog closes, but only if we're
|
||||
// still on the details page. We could be on a different page if the
|
||||
// user hit back while the options dialog was visible; in that case, the
|
||||
@ -145,7 +144,7 @@ cr.define('extensions', function() {
|
||||
this.changePage(
|
||||
{page: Page.DETAILS, extensionId: this.currentPage_.extensionId});
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
get keyboardShortcuts() {
|
||||
|
@ -37,7 +37,7 @@ cr.define('extensions', function() {
|
||||
return Math.min(Math.max(min, val), max);
|
||||
};
|
||||
|
||||
var onSizeChanged = function(e) {
|
||||
var onSizeChanged = e => {
|
||||
var minHeaderWidth = this.$$('#icon-and-name-wrapper img').offsetWidth +
|
||||
this.$$('#icon-and-name-wrapper span').offsetWidth +
|
||||
HEADER_EXTRA_SPACING;
|
||||
@ -48,7 +48,7 @@ cr.define('extensions', function() {
|
||||
bounded(minWidth, MAX_WIDTH, e.width) + 'px';
|
||||
this.$.dialog.style.width =
|
||||
(bounded(minWidth, MAX_WIDTH, e.width) + DIALOG_PADDING) + 'px';
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
this.extensionOptions_.onpreferredsizechanged = onSizeChanged;
|
||||
this.$.body.appendChild(this.extensionOptions_);
|
||||
|
@ -54,18 +54,18 @@ cr.define('extensions', function() {
|
||||
|
||||
/** @private */
|
||||
onRootBrowse_: function() {
|
||||
this.delegate.choosePackRootDirectory().then(function(path) {
|
||||
this.delegate.choosePackRootDirectory().then(path => {
|
||||
if (path)
|
||||
this.set('packDirectory_', path);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/** @private */
|
||||
onKeyBrowse_: function() {
|
||||
this.delegate.choosePrivateKeyPath().then(function(path) {
|
||||
this.delegate.choosePrivateKeyPath().then(path => {
|
||||
if (path)
|
||||
this.set('keyFile_', path);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/** @private */
|
||||
|
@ -43,14 +43,13 @@ cr.define('extensions', function() {
|
||||
chrome.developerPrivate.onItemStateChanged.addListener(
|
||||
this.onItemStateChanged_.bind(this));
|
||||
chrome.developerPrivate.getExtensionsInfo(
|
||||
{includeDisabled: true, includeTerminated: true},
|
||||
function(extensions) {
|
||||
{includeDisabled: true, includeTerminated: true}, extensions => {
|
||||
this.extensions_ = extensions;
|
||||
for (let extension of extensions)
|
||||
this.manager_.addItem(extension);
|
||||
|
||||
this.manager_.initPage();
|
||||
}.bind(this));
|
||||
});
|
||||
chrome.developerPrivate.getProfileConfiguration(
|
||||
this.onProfileStateChanged_.bind(this));
|
||||
}
|
||||
@ -181,13 +180,13 @@ cr.define('extensions', function() {
|
||||
if (this.isDeleting_)
|
||||
return;
|
||||
this.isDeleting_ = true;
|
||||
chrome.management.uninstall(id, {showConfirmDialog: true}, function() {
|
||||
chrome.management.uninstall(id, {showConfirmDialog: true}, () => {
|
||||
// The "last error" was almost certainly the user canceling the dialog.
|
||||
// Do nothing. We only check it so we don't get noisy logs.
|
||||
/** @suppress {suspiciousCode} */
|
||||
chrome.runtime.lastError;
|
||||
this.isDeleting_ = false;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
|
Reference in New Issue
Block a user