Chromium Code Reviews| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 /** @private {Promise} */ | 277 /** @private {Promise} */ |
| 278 this.extensionsUpdated_ = new Promise(function(resolve, reject) { | 278 this.extensionsUpdated_ = new Promise(function(resolve, reject) { |
| 279 chrome.developerPrivate.getExtensionsInfo( | 279 chrome.developerPrivate.getExtensionsInfo( |
| 280 {includeDisabled: true, includeTerminated: true}, | 280 {includeDisabled: true, includeTerminated: true}, |
| 281 function(extensions) { | 281 function(extensions) { |
| 282 // Sort in order of unpacked vs. packed, followed by name, followed by | 282 // Sort in order of unpacked vs. packed, followed by name, followed by |
| 283 // id. | 283 // id. |
| 284 extensions.sort(compareExtensions); | 284 extensions.sort(compareExtensions); |
| 285 this.extensions_ = extensions; | 285 this.extensions_ = extensions; |
| 286 this.showExtensionNodes_(); | 286 this.showExtensionNodes_(); |
| 287 resolve(); | 287 resolve(); |
|
Dan Beam
2015/04/14 21:44:13
nit: call this.whateverYouEndUpNamingIt_() here an
hcarmona
2015/04/14 22:06:24
I was looking at this place, but the list is still
Dan Beam
2015/04/14 22:19:43
talked about this IRL: I meant that after resolve(
| |
| 288 }.bind(this)); | 288 }.bind(this)); |
| 289 }.bind(this)); | 289 }.bind(this)); |
| 290 return this.extensionsUpdated_; | 290 return this.extensionsUpdated_; |
| 291 }, | 291 }, |
| 292 | 292 |
| 293 /** | |
| 294 * Updates any element that needs to be visible to update properly. | |
| 295 * @param {boolean} visible Whether the extension list is visible. | |
|
Devlin
2015/04/14 22:23:55
Drive-by: What param?
| |
| 296 */ | |
| 297 updateVisible: function() { | |
|
not at google - send to devlin
2015/04/14 21:14:50
TBH "updateVisible" is still too vague for me. Are
Dan Beam
2015/04/14 21:44:13
how about:
- updateAndHighlight()
- onExtensionsSh
hcarmona
2015/04/14 22:06:24
We can go with onUpdateFinished_() and make it pri
not at google - send to devlin
2015/04/14 22:39:25
Gotcha. Maybe this doesn't make sense, but could t
hcarmona
2015/04/14 23:06:43
Scrolling should happen when the list is loaded, i
| |
| 298 this.updateFocusableElements(); | |
| 299 | |
| 300 var idToHighlight = this.getIdQueryParam_(); | |
| 301 if (idToHighlight && $(idToHighlight)) | |
| 302 this.scrollToNode_(idToHighlight); | |
| 303 | |
| 304 var idToOpenOptions = this.getOptionsQueryParam_(); | |
| 305 if (idToOpenOptions && $(idToOpenOptions)) | |
| 306 this.showEmbeddedExtensionOptions_(idToOpenOptions, true); | |
| 307 }, | |
| 308 | |
| 293 /** @return {number} The number of extensions being displayed. */ | 309 /** @return {number} The number of extensions being displayed. */ |
| 294 getNumExtensions: function() { | 310 getNumExtensions: function() { |
| 295 return this.extensions_.length; | 311 return this.extensions_.length; |
| 296 }, | 312 }, |
| 297 | 313 |
| 298 getIdQueryParam_: function() { | 314 getIdQueryParam_: function() { |
| 299 return parseQueryParams(document.location)['id']; | 315 return parseQueryParams(document.location)['id']; |
| 300 }, | 316 }, |
| 301 | 317 |
| 302 getOptionsQueryParam_: function() { | 318 getOptionsQueryParam_: function() { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 331 focusableNode.getEquivalentElement( | 347 focusableNode.getEquivalentElement( |
| 332 document.activeElement).focus(); | 348 document.activeElement).focus(); |
| 333 } | 349 } |
| 334 } | 350 } |
| 335 | 351 |
| 336 node.parentElement.removeChild(node); | 352 node.parentElement.removeChild(node); |
| 337 // Unregister the removed node from events. | 353 // Unregister the removed node from events. |
| 338 assertInstanceof(node, ExtensionFocusRow).destroy(); | 354 assertInstanceof(node, ExtensionFocusRow).destroy(); |
| 339 } | 355 } |
| 340 } | 356 } |
| 341 | |
| 342 var idToHighlight = this.getIdQueryParam_(); | |
| 343 if (idToHighlight && $(idToHighlight)) | |
| 344 this.scrollToNode_(idToHighlight); | |
| 345 | |
| 346 var idToOpenOptions = this.getOptionsQueryParam_(); | |
| 347 if (idToOpenOptions && $(idToOpenOptions)) | |
| 348 this.showEmbeddedExtensionOptions_(idToOpenOptions, true); | |
| 349 }, | 357 }, |
| 350 | 358 |
| 351 /** Updates each row's focusable elements without rebuilding the grid. */ | 359 /** Updates each row's focusable elements without rebuilding the grid. */ |
| 352 updateFocusableElements: function() { | 360 updateFocusableElements: function() { |
| 353 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]'); | 361 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]'); |
| 354 for (var i = 0; i < rows.length; ++i) { | 362 for (var i = 0; i < rows.length; ++i) { |
| 355 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements(); | 363 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements(); |
| 356 } | 364 } |
| 357 }, | 365 }, |
| 358 | 366 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1057 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1]; | 1065 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1]; |
| 1058 this.createNode_(extension, nextExt ? $(nextExt.id) : null); | 1066 this.createNode_(extension, nextExt ? $(nextExt.id) : null); |
| 1059 } | 1067 } |
| 1060 } | 1068 } |
| 1061 }; | 1069 }; |
| 1062 | 1070 |
| 1063 return { | 1071 return { |
| 1064 ExtensionList: ExtensionList | 1072 ExtensionList: ExtensionList |
| 1065 }; | 1073 }; |
| 1066 }); | 1074 }); |
| OLD | NEW |