OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <include src="extension_error.js"> | 5 <include src="extension_error.js"> |
6 | 6 |
7 /////////////////////////////////////////////////////////////////////////////// | 7 /////////////////////////////////////////////////////////////////////////////// |
8 // ExtensionFocusRow: | 8 // ExtensionFocusRow: |
9 | 9 |
10 /** | 10 /** |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 * @param {boolean} enableAppInfoDialog Whether or not the app info dialog | 211 * @param {boolean} enableAppInfoDialog Whether or not the app info dialog |
212 * is enabled. | 212 * is enabled. |
213 * @return {Promise} A promise that is resolved once the extensions data is | 213 * @return {Promise} A promise that is resolved once the extensions data is |
214 * fully updated. | 214 * fully updated. |
215 */ | 215 */ |
216 updateExtensionsData: function(incognitoAvailable, enableAppInfoDialog) { | 216 updateExtensionsData: function(incognitoAvailable, enableAppInfoDialog) { |
217 // If we start to need more information about the extension configuration, | 217 // If we start to need more information about the extension configuration, |
218 // consider passing in the full object from the ExtensionSettings. | 218 // consider passing in the full object from the ExtensionSettings. |
219 this.incognitoAvailable_ = incognitoAvailable; | 219 this.incognitoAvailable_ = incognitoAvailable; |
220 this.enableAppInfoDialog_ = enableAppInfoDialog; | 220 this.enableAppInfoDialog_ = enableAppInfoDialog; |
221 return new Promise(function(resolve, reject) { | 221 /** @private {Promise} */ |
| 222 this.extensionsUpdated_ = new Promise(function(resolve, reject) { |
222 chrome.developerPrivate.getExtensionsInfo( | 223 chrome.developerPrivate.getExtensionsInfo( |
223 {includeDisabled: true, includeTerminated: true}, | 224 {includeDisabled: true, includeTerminated: true}, |
224 function(extensions) { | 225 function(extensions) { |
225 // Sort in order of unpacked vs. packed, followed by name, followed by | 226 // Sort in order of unpacked vs. packed, followed by name, followed by |
226 // id. | 227 // id. |
227 extensions.sort(function(a, b) { | 228 extensions.sort(function(a, b) { |
228 function compare(x, y) { | 229 function compare(x, y) { |
229 return x < y ? -1 : (x > y ? 1 : 0); | 230 return x < y ? -1 : (x > y ? 1 : 0); |
230 } | 231 } |
231 function compareLocation(x, y) { | 232 function compareLocation(x, y) { |
232 return x.location == chrome.developerPrivate.Location.UNPACKED ? | 233 return x.location == chrome.developerPrivate.Location.UNPACKED ? |
233 -1 : (x.location == y.location ? 0 : 1); | 234 -1 : (x.location == y.location ? 0 : 1); |
234 } | 235 } |
235 return compareLocation(a, b) || | 236 return compareLocation(a, b) || |
236 compare(a.name.toLowerCase(), b.name.toLowerCase()) || | 237 compare(a.name.toLowerCase(), b.name.toLowerCase()) || |
237 compare(a.id, b.id); | 238 compare(a.id, b.id); |
238 }); | 239 }); |
239 this.extensions_ = extensions; | 240 this.extensions_ = extensions; |
240 this.showExtensionNodes_(); | 241 this.showExtensionNodes_(); |
241 resolve(); | 242 resolve(); |
242 }.bind(this)); | 243 }.bind(this)); |
243 }.bind(this)); | 244 }.bind(this)); |
| 245 return this.extensionsUpdated_; |
244 }, | 246 }, |
245 | 247 |
246 /** @return {number} The number of extensions being displayed. */ | 248 /** @return {number} The number of extensions being displayed. */ |
247 getNumExtensions: function() { | 249 getNumExtensions: function() { |
248 return this.extensions_.length; | 250 return this.extensions_.length; |
249 }, | 251 }, |
250 | 252 |
251 getIdQueryParam_: function() { | 253 getIdQueryParam_: function() { |
252 return parseQueryParams(document.location)['id']; | 254 return parseQueryParams(document.location)['id']; |
253 }, | 255 }, |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 983 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
982 // after its showing animation? Makes very little sense to me. | 984 // after its showing animation? Makes very little sense to me. |
983 overlay.setInitialFocus(); | 985 overlay.setInitialFocus(); |
984 }, | 986 }, |
985 }; | 987 }; |
986 | 988 |
987 return { | 989 return { |
988 ExtensionList: ExtensionList | 990 ExtensionList: ExtensionList |
989 }; | 991 }; |
990 }); | 992 }); |
OLD | NEW |