Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 var ItemList = Polymer({ | 6 var ItemList = Polymer({ |
| 7 is: 'extensions-item-list', | 7 is: 'extensions-item-list', |
| 8 | 8 |
| 9 behaviors: [Polymer.NeonAnimatableBehavior, Polymer.IronResizableBehavior], | 9 behaviors: [Polymer.NeonAnimatableBehavior, Polymer.IronResizableBehavior], |
| 10 | 10 |
| 11 properties: { | 11 properties: { |
| 12 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */ | 12 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */ |
| 13 items: Array, | 13 items: Array, |
| 14 | 14 |
| 15 /** @type {extensions.ItemDelegate} */ | 15 /** @type {extensions.ItemDelegate} */ |
| 16 delegate: Object, | 16 delegate: Object, |
| 17 | 17 |
| 18 inDevMode: { | 18 inDevMode: { |
| 19 type: Boolean, | 19 type: Boolean, |
| 20 value: false, | 20 value: false, |
| 21 }, | 21 }, |
| 22 | 22 |
| 23 filter: String, | 23 filter: String, |
| 24 | |
| 25 /** @private */ | |
|
dpapad
2017/07/07 00:45:04
Can we annotate what does the array hold? !Array<S
scottchen
2017/07/07 23:08:42
Done.
| |
| 26 shownItems_: { | |
| 27 type: Array, | |
| 28 computed: 'computeShownItems_(items.*, filter)', | |
| 29 } | |
| 24 }, | 30 }, |
| 25 | 31 |
| 26 listeners: { | 32 listeners: { |
| 27 'list.extension-item-size-changed': 'itemSizeChanged_', | 33 'list.extension-item-size-changed': 'itemSizeChanged_', |
| 28 }, | 34 }, |
| 29 | 35 |
| 30 ready: function() { | 36 ready: function() { |
| 31 /** @type {extensions.AnimationHelper} */ | 37 /** @type {extensions.AnimationHelper} */ |
| 32 this.animationHelper = new extensions.AnimationHelper(this, this.$.list); | 38 this.animationHelper = new extensions.AnimationHelper(this, this.$.list); |
| 33 this.animationHelper.setEntryAnimations([extensions.Animation.FADE_IN]); | 39 this.animationHelper.setEntryAnimations([extensions.Animation.FADE_IN]); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 * @param {Object} changeRecord The changeRecord for |items|. | 72 * @param {Object} changeRecord The changeRecord for |items|. |
| 67 * @param {string} filter The updated filter string. | 73 * @param {string} filter The updated filter string. |
| 68 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} | 74 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} |
| 69 * @private | 75 * @private |
| 70 */ | 76 */ |
| 71 computeShownItems_: function(changeRecord, filter) { | 77 computeShownItems_: function(changeRecord, filter) { |
| 72 return this.items.filter(function(item) { | 78 return this.items.filter(function(item) { |
| 73 return item.name.toLowerCase().includes(this.filter.toLowerCase()); | 79 return item.name.toLowerCase().includes(this.filter.toLowerCase()); |
| 74 }, this); | 80 }, this); |
| 75 }, | 81 }, |
| 82 | |
| 83 isEmpty_: function(length) { | |
| 84 return length == 0; | |
| 85 } | |
| 76 }); | 86 }); |
| 77 | 87 |
| 78 return { | 88 return { |
| 79 ItemList: ItemList, | 89 ItemList: ItemList, |
| 80 }; | 90 }; |
| 81 }); | 91 }); |
| OLD | NEW |