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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 this.closeDropdownMenu_(); | 57 this.closeDropdownMenu_(); |
58 }, | 58 }, |
59 | 59 |
60 /** | 60 /** |
61 * @param {{model:Object}} event | 61 * @param {{model:Object}} event |
62 * @private | 62 * @private |
63 */ | 63 */ |
64 onRemoveTap_: function(event) { | 64 onRemoveTap_: function(event) { |
65 var index = this.printers.indexOf(assert(this.activePrinter_)); | 65 var index = this.printers.indexOf(assert(this.activePrinter_)); |
66 this.splice('printers', index, 1); | 66 this.splice('printers', index, 1); |
67 this.browserProxy_.removeCupsPrinter(this.activePrinter_.printerId, | 67 this.browserProxy_.removeCupsPrinter( |
68 this.activePrinter_.printerName); | 68 this.activePrinter_.printerId, this.activePrinter_.printerName); |
69 this.closeDropdownMenu_(); | 69 this.closeDropdownMenu_(); |
70 }, | 70 }, |
71 | 71 |
72 /** @private */ | 72 /** @private */ |
73 closeDropdownMenu_: function() { | 73 closeDropdownMenu_: function() { |
74 this.activePrinter_ = null; | 74 this.activePrinter_ = null; |
75 var menu = /** @type {!CrActionMenuElement} */ ( | 75 var menu = /** @type {!CrActionMenuElement} */ ( |
76 this.$$('dialog[is=cr-action-menu]')); | 76 this.$$('dialog[is=cr-action-menu]')); |
77 menu.close(); | 77 menu.close(); |
78 }, | 78 }, |
79 | 79 |
80 /** | 80 /** |
81 * The filter callback function to show printers based on |searchTerm|. | 81 * The filter callback function to show printers based on |searchTerm|. |
82 * @param {string} searchTerm | 82 * @param {string} searchTerm |
83 * @private | 83 * @private |
84 */ | 84 */ |
85 filterPrinter_: function(searchTerm) { | 85 filterPrinter_: function(searchTerm) { |
86 if (!searchTerm) | 86 if (!searchTerm) |
87 return null; | 87 return null; |
88 return function(printer) { | 88 return function(printer) { |
89 return printer.printerName.toLowerCase().includes( | 89 return printer.printerName.toLowerCase().includes( |
90 searchTerm.toLowerCase()); | 90 searchTerm.toLowerCase()); |
91 }; | 91 }; |
92 }, | 92 }, |
93 }); | 93 }); |
OLD | NEW |