| 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: [ |
| 10 Polymer.NeonAnimatableBehavior, |
| 11 Polymer.IronResizableBehavior |
| 12 ], |
| 13 |
| 9 properties: { | 14 properties: { |
| 15 animationConfig: { |
| 16 type: Object, |
| 17 value: function() { |
| 18 return { |
| 19 exit: [{ |
| 20 name: 'hero-animation', |
| 21 id: 'hero', |
| 22 fromPage: this, |
| 23 }], |
| 24 }; |
| 25 }, |
| 26 }, |
| 27 |
| 10 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */ | 28 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */ |
| 11 items: Array, | 29 items: Array, |
| 12 | 30 |
| 13 /** @type {extensions.ItemDelegate} */ | 31 /** @type {extensions.ItemDelegate} */ |
| 14 delegate: Object, | 32 delegate: Object, |
| 15 | 33 |
| 16 header: String, | 34 header: String, |
| 17 | 35 |
| 18 inDevMode: { | 36 inDevMode: { |
| 19 type: Boolean, | 37 type: Boolean, |
| 20 value: false, | 38 value: false, |
| 21 }, | 39 }, |
| 22 | 40 |
| 23 filter: String, | 41 filter: String, |
| 24 }, | 42 }, |
| 25 | 43 |
| 26 listeners: { | 44 listeners: { |
| 27 'list.extension-item-size-changed': 'itemSizeChanged_', | 45 'list.extension-item-size-changed': 'itemSizeChanged_', |
| 46 'list.extension-item-show-details': 'showItemDetails_', |
| 28 }, | 47 }, |
| 29 | 48 |
| 30 /** | 49 /** |
| 31 * Updates the size for a given item. | 50 * Updates the size for a given item. |
| 32 * @param {CustomEvent} e | 51 * @param {CustomEvent} e |
| 33 * @private | 52 * @private |
| 34 * @suppress {checkTypes} Closure doesn't know $.list is an IronList. | 53 * @suppress {checkTypes} Closure doesn't know $.list is an IronList. |
| 35 */ | 54 */ |
| 36 itemSizeChanged_: function(e) { | 55 itemSizeChanged_: function(e) { |
| 37 this.$.list.updateSizeForItem(e.detail.item); | 56 this.$.list.updateSizeForItem(e.detail.item); |
| 38 }, | 57 }, |
| 39 | 58 |
| 40 /** | 59 /** |
| 60 * Called right before an item enters the detailed view. |
| 61 * @param {CustomEvent} e |
| 62 * @private |
| 63 */ |
| 64 showItemDetails_: function(e) { |
| 65 this.sharedElements = {hero: e.detail.element}; |
| 66 }, |
| 67 |
| 68 /** |
| 41 * Computes the list of items to be shown. | 69 * Computes the list of items to be shown. |
| 42 * @param {Object} changeRecord The changeRecord for |items|. | 70 * @param {Object} changeRecord The changeRecord for |items|. |
| 43 * @param {string} filter The updated filter string. | 71 * @param {string} filter The updated filter string. |
| 44 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} | 72 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} |
| 45 * @private | 73 * @private |
| 46 */ | 74 */ |
| 47 computeShownItems_: function(changeRecord, filter) { | 75 computeShownItems_: function(changeRecord, filter) { |
| 48 return this.items.filter(function(item) { | 76 return this.items.filter(function(item) { |
| 49 return item.name.toLowerCase().includes(this.filter.toLowerCase()); | 77 return item.name.toLowerCase().includes(this.filter.toLowerCase()); |
| 50 }, this); | 78 }, this); |
| 51 }, | 79 }, |
| 52 }); | 80 }); |
| 53 | 81 |
| 54 return { | 82 return { |
| 55 ItemList: ItemList, | 83 ItemList: ItemList, |
| 56 }; | 84 }; |
| 57 }); | 85 }); |
| OLD | NEW |