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

Side by Side Diff: chrome/browser/resources/settings/printing_page/cups_printers_list.js

Issue 2333283004: [CUPS] Implement the UI handler for adding a new printer. (Closed)
Patch Set: Address michaelpg@'s offline comment. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 'settings-cups-printers-list' is a component for a list of 6 * @fileoverview 'settings-cups-printers-list' is a component for a list of
7 * CUPS printers. 7 * CUPS printers.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-cups-printers-list', 10 is: 'settings-cups-printers-list',
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 /** 43 /**
44 * @param {{model:Object}} event 44 * @param {{model:Object}} event
45 * @private 45 * @private
46 */ 46 */
47 onRemoveTap_: function(event) { 47 onRemoveTap_: function(event) {
48 this.closeDropdownMenu_(); 48 this.closeDropdownMenu_();
49 49
50 var index = this.printers.indexOf(event.model.item); 50 var index = this.printers.indexOf(event.model.item);
51 this.splice('printers', index, 1); 51 this.splice('printers', index, 1);
52 this.browserProxy_.removeCupsPrinter(event.model.item.printerId); 52 this.browserProxy_.removeCupsPrinter(event.model.item.printerId,
53 event.model.item.printerName);
53 }, 54 },
54 55
55 /** @private */ 56 /** @private */
56 closeDropdownMenu_: function() { 57 closeDropdownMenu_: function() {
57 this.$$('iron-dropdown').close(); 58 this.$$('iron-dropdown').close();
58 }, 59 },
59 60
60 /** 61 /**
61 * The filter callback function to show printers based on |searchTerm|. 62 * The filter callback function to show printers based on |searchTerm|.
62 * @param {string} searchTerm 63 * @param {string} searchTerm
63 * @private 64 * @private
64 */ 65 */
65 filterPrinter_: function(searchTerm) { 66 filterPrinter_: function(searchTerm) {
66 if (!searchTerm) 67 if (!searchTerm)
67 return null; 68 return null;
68 return function(printer) { 69 return function(printer) {
69 return printer.printerName.toLowerCase().includes( 70 return printer.printerName.toLowerCase().includes(
70 searchTerm.toLowerCase()); 71 searchTerm.toLowerCase());
71 }; 72 };
72 }, 73 },
73 }); 74 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698