Commit 2bd0fd44 authored by dpapad's avatar dpapad Committed by Commit Bot

Settings WebUI cleanup: Declaratively listen for 'close' event when possible.

Bug: None
Change-Id: I3ab1fd657115a98baa6d88a11ecaf6d0457c83c7
Reviewed-on: https://chromium-review.googlesource.com/1101711
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567700}
parent c2b32b44
......@@ -394,7 +394,8 @@
</settings-animated-pages>
<template is="dom-if" if="[[showAddLanguagesDialog_]]" restamp>
<settings-add-languages-dialog languages="{{languages}}"
language-helper="[[languageHelper]]">
language-helper="[[languageHelper]]"
on-close="onAddLanguagesDialogClose_">
</settings-add-languages-dialog>
</template>
</template>
......
......@@ -146,13 +146,12 @@ Polymer({
onAddLanguagesTap_: function(e) {
e.preventDefault();
this.showAddLanguagesDialog_ = true;
this.async(function() {
const dialog = this.$$('settings-add-languages-dialog');
dialog.addEventListener('close', () => {
this.showAddLanguagesDialog_ = false;
cr.ui.focusWithoutInk(assert(this.$.addLanguages));
});
});
},
/** @private */
onAddLanguagesDialogClose_: function() {
this.showAddLanguagesDialog_ = false;
cr.ui.focusWithoutInk(assert(this.$.addLanguages));
},
/**
......
......@@ -55,7 +55,8 @@
<template is="dom-if" if="[[showCupsEditPrinterDialog_]]" restamp>
<settings-cups-edit-printer-dialog id="editPrinterDialog"
active-printer="{{activePrinter}}">
active-printer="{{activePrinter}}"
on-close="onEditPrinterDialogClose_">
</settings-cups-edit-printer-dialog>
</template>
......
......@@ -185,12 +185,11 @@ Polymer({
/** @private */
onShowCupsEditPrinterDialog_: function() {
this.showCupsEditPrinterDialog_ = true;
this.async(function() {
const dialog = this.$$('settings-cups-edit-printer-dialog');
dialog.addEventListener('close', function() {
this.showCupsEditPrinterDialog_ = false;
}.bind(this));
});
},
/** @private */
onEditPrinterDialogClose_: function() {
this.showCupsEditPrinterDialog_ = false;
},
/**
......
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