OLD | NEW |
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 Loading... |
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 }); |
OLD | NEW |