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: [ | |
| 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-will-show-details': 'itemWillShowDetails_', | |
| 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 |
|
Dan Beam
2016/04/26 01:32:12
doc
Devlin
2016/04/26 17:24:18
Done.
| |
| 59 itemWillShowDetails_: function(e) { | |
| 60 this.sharedElements = { hero: e.detail.element }; | |
|
Dan Beam
2016/04/26 01:32:12
no spaces around braces
Devlin
2016/04/26 17:24:18
Done.
| |
| 61 }, | |
| 62 | |
| 40 /** | 63 /** |
| 41 * Computes the list of items to be shown. | 64 * Computes the list of items to be shown. |
| 42 * @param {Object} changeRecord The changeRecord for |items|. | 65 * @param {Object} changeRecord The changeRecord for |items|. |
| 43 * @param {string} filter The updated filter string. | 66 * @param {string} filter The updated filter string. |
| 44 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} | 67 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} |
| 45 * @private | 68 * @private |
| 46 */ | 69 */ |
| 47 computeShownItems_: function(changeRecord, filter) { | 70 computeShownItems_: function(changeRecord, filter) { |
| 48 return this.items.filter(function(item) { | 71 return this.items.filter(function(item) { |
| 49 return item.name.toLowerCase().includes(this.filter.toLowerCase()); | 72 return item.name.toLowerCase().includes(this.filter.toLowerCase()); |
| 50 }, this); | 73 }, this); |
| 51 }, | 74 }, |
| 52 }); | 75 }); |
| 53 | 76 |
| 54 return { | 77 return { |
| 55 ItemList: ItemList, | 78 ItemList: ItemList, |
| 56 }; | 79 }; |
| 57 }); | 80 }); |
| OLD | NEW |