Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/browser/resources/md_extensions/item_list.js

Issue 1913353002: [MD Extensions] Add a details subpage, move to one list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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],
10
9 properties: { 11 properties: {
12 animationConfig: {
13 type: Object,
14 value: function() {
15 return {
16 exit: [{
17 name: 'hero-animation',
18 id: 'hero',
19 fromPage: this,
20 }],
21 };
22 },
23 },
24
10 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */ 25 /** @type {Array<!chrome.developerPrivate.ExtensionInfo>} */
11 items: Array, 26 items: Array,
12 27
13 /** @type {extensions.ItemDelegate} */ 28 /** @type {extensions.ItemDelegate} */
14 delegate: Object, 29 delegate: Object,
15 30
16 header: String, 31 header: String,
17 32
18 inDevMode: { 33 inDevMode: {
19 type: Boolean, 34 type: Boolean,
20 value: false, 35 value: false,
21 }, 36 },
22 37
23 filter: String, 38 filter: String,
24 }, 39 },
25 40
26 listeners: { 41 listeners: {
27 'list.extension-item-size-changed': 'itemSizeChanged_', 42 'list.extension-item-size-changed': 'itemSizeChanged_',
43 'list.extension-item-will-show-details': 'itemWillShowDetails_',
28 }, 44 },
29 45
30 /** 46 /**
31 * Updates the size for a given item. 47 * Updates the size for a given item.
32 * @param {CustomEvent} e 48 * @param {CustomEvent} e
33 * @private 49 * @private
34 * @suppress {checkTypes} Closure doesn't know $.list is an IronList. 50 * @suppress {checkTypes} Closure doesn't know $.list is an IronList.
35 */ 51 */
36 itemSizeChanged_: function(e) { 52 itemSizeChanged_: function(e) {
37 this.$.list.updateSizeForItem(e.detail.item); 53 this.$.list.updateSizeForItem(e.detail.item);
38 }, 54 },
39 55
56 itemWillShowDetails_: function(e) {
57 this.sharedElements = { hero: e.detail.element };
Devlin 2016/04/23 01:50:11 This could be more easily avoided if there was an
58 },
59
40 /** 60 /**
41 * Computes the list of items to be shown. 61 * Computes the list of items to be shown.
42 * @param {Object} changeRecord The changeRecord for |items|. 62 * @param {Object} changeRecord The changeRecord for |items|.
43 * @param {string} filter The updated filter string. 63 * @param {string} filter The updated filter string.
44 * @return {Array<!chrome.developerPrivate.ExtensionInfo>} 64 * @return {Array<!chrome.developerPrivate.ExtensionInfo>}
45 * @private 65 * @private
46 */ 66 */
47 computeShownItems_: function(changeRecord, filter) { 67 computeShownItems_: function(changeRecord, filter) {
48 return this.items.filter(function(item) { 68 return this.items.filter(function(item) {
49 return item.name.toLowerCase().includes(this.filter.toLowerCase()); 69 return item.name.toLowerCase().includes(this.filter.toLowerCase());
50 }, this); 70 }, this);
51 }, 71 },
52 }); 72 });
53 73
54 return { 74 return {
55 ItemList: ItemList, 75 ItemList: ItemList,
56 }; 76 };
57 }); 77 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698