Chromium Code Reviews| Index: chrome/browser/resources/settings/printing_page/cups_printers_list.js |
| diff --git a/chrome/browser/resources/settings/printing_page/cups_printers_list.js b/chrome/browser/resources/settings/printing_page/cups_printers_list.js |
| index 6364807697e375a5ddacf40486c771d430c9aecc..0a2b626707e0cebd3b6be11ab17ff307db764686 100644 |
| --- a/chrome/browser/resources/settings/printing_page/cups_printers_list.js |
| +++ b/chrome/browser/resources/settings/printing_page/cups_printers_list.js |
| @@ -19,6 +19,12 @@ Polymer({ |
| searchTerm: { |
| type: String, |
| }, |
| + |
| + /** |
| + * The model for the printer action menu. |
| + * @private {?CupsPrinterInfo} |
| + */ |
| + activePrinter_: Object, |
| }, |
| /** @private {settings.CupsPrintersBrowserProxy} */ |
| @@ -30,14 +36,26 @@ Polymer({ |
| }, |
| /** |
| + * @param {!{model: !{item: !CupsPrinterInfo}}} e |
| + * @private |
| + */ |
| + onOpenActionMenuTap_: function(e) { |
| + this.activePrinter_ = e.model.item; |
| + var menu = /** @type {!SettingsActionMenuElement} */ ( |
| + this.$$('dialog[is=settings-action-menu]')); |
| + menu.showAt(/** @type {!Element} */ ( |
|
michaelpg
2016/10/20 19:49:06
why is this cast necessary? just to tell closure i
dpapad
2016/10/20 21:58:28
Correct.
|
| + Polymer.dom(/** @type {!Event} */ (e)).localTarget)); |
| + }, |
| + |
| + /** |
| * @param {{model:Object}} event |
| * @private |
| */ |
| onDetailsTap_: function(event) { |
| + // Event is caught by 'settings-printing-page'. |
| + this.fire('show-cups-printer-details', this.activePrinter_); |
| this.closeDropdownMenu_(); |
|
michaelpg
2016/10/20 19:49:06
rm blank line
dpapad
2016/10/20 21:58:28
Done.
|
| - // Event is caught by 'settings-printing-page'. |
| - this.fire('show-cups-printer-details', event.model.item); |
| }, |
| /** |
| @@ -45,17 +63,19 @@ Polymer({ |
| * @private |
| */ |
| onRemoveTap_: function(event) { |
| - this.closeDropdownMenu_(); |
| - |
| - var index = this.printers.indexOf(event.model.item); |
| + var index = this.printers.indexOf(assert(this.activePrinter_)); |
| this.splice('printers', index, 1); |
| - this.browserProxy_.removeCupsPrinter(event.model.item.printerId, |
| - event.model.item.printerName); |
| + this.browserProxy_.removeCupsPrinter(this.activePrinter_.printerId, |
| + this.activePrinter_.printerName); |
| + this.closeDropdownMenu_(); |
| }, |
| /** @private */ |
| closeDropdownMenu_: function() { |
| - this.$$('iron-dropdown').close(); |
| + this.activePrinter_ = null; |
| + var menu = /** @type {!SettingsActionMenuElement} */ ( |
| + this.$$('dialog[is=settings-action-menu]')); |
| + menu.close(); |
| }, |
| /** |