Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: chrome/browser/resources/settings/printing_page/cups_printers_list.js

Issue 2427323003: MD Settings: Migrate cups_printers_list.html to settings-action-menu. (Closed)
Patch Set: Nit Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/printing_page/cups_printers_list.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3b46bc490de5743a91a012407e421f85fa8b1bc8 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,25 @@ 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} */ (
+ Polymer.dom(/** @type {!Event} */ (e)).localTarget));
+ },
+
+ /**
* @param {{model:Object}} event
* @private
*/
onDetailsTap_: function(event) {
- this.closeDropdownMenu_();
-
// Event is caught by 'settings-printing-page'.
- this.fire('show-cups-printer-details', event.model.item);
+ this.fire('show-cups-printer-details', this.activePrinter_);
+ this.closeDropdownMenu_();
},
/**
@@ -45,17 +62,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();
},
/**
« no previous file with comments | « chrome/browser/resources/settings/printing_page/cups_printers_list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698