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 /** | 5 /** |
| 6 * The different pages that can be shown at a time. | 6 * The different pages that can be shown at a time. |
| 7 * Note: This must remain in sync with the order in manager.html! | 7 * Note: This must remain in sync with the order in manager.html! |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 */ | 9 */ |
| 10 var Page = { | 10 var Page = { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 return 0; | 36 return 0; |
| 37 } | 37 } |
| 38 return compareLocation(a, b) || | 38 return compareLocation(a, b) || |
| 39 compare(a.name.toLowerCase(), b.name.toLowerCase()) || | 39 compare(a.name.toLowerCase(), b.name.toLowerCase()) || |
| 40 compare(a.id, b.id); | 40 compare(a.id, b.id); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 var Manager = Polymer({ | 43 var Manager = Polymer({ |
| 44 is: 'extensions-manager', | 44 is: 'extensions-manager', |
| 45 | 45 |
| 46 behaviors: [I18nBehavior], | |
| 47 | |
| 46 properties: { | 48 properties: { |
| 47 /** @type {extensions.Sidebar} */ | 49 /** @type {extensions.Sidebar} */ |
| 48 sidebar: Object, | 50 sidebar: Object, |
| 49 | 51 |
| 50 /** @type {extensions.ItemDelegate} */ | 52 /** @type {extensions.ItemDelegate} */ |
| 51 itemDelegate: Object, | 53 itemDelegate: Object, |
| 52 | 54 |
| 53 inDevMode: { | 55 inDevMode: { |
| 54 type: Boolean, | 56 type: Boolean, |
| 55 value: false, | 57 value: false, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 66 value: function() { return []; }, | 68 value: function() { return []; }, |
| 67 }, | 69 }, |
| 68 | 70 |
| 69 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ | 71 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ |
| 70 apps: { | 72 apps: { |
| 71 type: Array, | 73 type: Array, |
| 72 value: function() { return []; }, | 74 value: function() { return []; }, |
| 73 }, | 75 }, |
| 74 }, | 76 }, |
| 75 | 77 |
| 76 behaviors: [ | |
| 77 I18nBehavior, | |
| 78 ], | |
| 79 | |
| 80 listeners: { | 78 listeners: { |
| 81 'items-list.extension-item-show-details': 'showItemDetails_', | 79 'items-list.extension-item-show-details': 'showItemDetails_', |
| 82 }, | 80 }, |
| 83 | 81 |
| 84 created: function() { | 82 created: function() { |
| 85 this.readyPromiseResolver = new PromiseResolver(); | 83 this.readyPromiseResolver = new PromiseResolver(); |
| 86 }, | 84 }, |
| 87 | 85 |
| 88 ready: function() { | 86 ready: function() { |
| 89 /** @type {extensions.Sidebar} */ | 87 /** @type {extensions.Sidebar} */ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 computeListHidden_: function() { | 146 computeListHidden_: function() { |
| 149 return this.$['items-list'].items.length == 0; | 147 return this.$['items-list'].items.length == 0; |
| 150 }, | 148 }, |
| 151 | 149 |
| 152 /** | 150 /** |
| 153 * Creates and adds a new extensions-item element to the list, inserting it | 151 * Creates and adds a new extensions-item element to the list, inserting it |
| 154 * into its sorted position in the relevant section. | 152 * into its sorted position in the relevant section. |
| 155 * @param {!chrome.developerPrivate.ExtensionInfo} item The extension | 153 * @param {!chrome.developerPrivate.ExtensionInfo} item The extension |
| 156 * the new element is representing. | 154 * the new element is representing. |
| 157 */ | 155 */ |
| 158 addItem: function(item) { | 156 addItem: function(item) { |
|
michaelpg
2016/07/12 00:39:37
style guide also lists public methods before priva
Devlin
2016/07/12 20:30:18
I saw, but in this case, I thought the churn wasn'
michaelpg
2016/07/13 00:03:07
nah, that's fine. This grouping is logical itself
| |
| 159 var listId = this.getListId_(item.type); | 157 var listId = this.getListId_(item.type); |
| 160 // We should never try and add an existing item. | 158 // We should never try and add an existing item. |
| 161 assert(this.getIndexInList_(listId, item.id) == -1); | 159 assert(this.getIndexInList_(listId, item.id) == -1); |
| 162 var insertBeforeChild = this[listId].findIndex(function(listEl) { | 160 var insertBeforeChild = this[listId].findIndex(function(listEl) { |
| 163 return compareExtensions(listEl, item) > 0; | 161 return compareExtensions(listEl, item) > 0; |
| 164 }); | 162 }); |
| 165 if (insertBeforeChild == -1) | 163 if (insertBeforeChild == -1) |
| 166 insertBeforeChild = this[listId].length; | 164 insertBeforeChild = this[listId].length; |
| 167 this.splice(listId, insertBeforeChild, 0, item); | 165 this.splice(listId, insertBeforeChild, 0, item); |
| 168 }, | 166 }, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 }, | 283 }, |
| 286 | 284 |
| 287 /** @override */ | 285 /** @override */ |
| 288 showPackDialog: function() { | 286 showPackDialog: function() { |
| 289 this.manager_.$['pack-dialog'].show(); | 287 this.manager_.$['pack-dialog'].show(); |
| 290 } | 288 } |
| 291 }; | 289 }; |
| 292 | 290 |
| 293 return {Manager: Manager}; | 291 return {Manager: Manager}; |
| 294 }); | 292 }); |
| OLD | NEW |