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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(); |
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. | |
296 */ | |
297 updateVisibility: function(visible) { | |
298 if (!visible) | |
Dan Beam
2015/04/14 20:33:56
i guess I see why you're doing this but it's certa
not at google - send to devlin
2015/04/14 20:38:50
Yeah - it looks odd to me to only be using the par
hcarmona
2015/04/14 21:03:17
Moved the visibility check to the call site and re
| |
299 return; | |
300 | |
301 this.updateFocusableElements(); | |
302 | |
303 var idToHighlight = this.getIdQueryParam_(); | |
304 if (idToHighlight && $(idToHighlight)) | |
305 this.scrollToNode_(idToHighlight); | |
306 | |
307 var idToOpenOptions = this.getOptionsQueryParam_(); | |
308 if (idToOpenOptions && $(idToOpenOptions)) | |
309 this.showEmbeddedExtensionOptions_(idToOpenOptions, true); | |
310 }, | |
311 | |
293 /** @return {number} The number of extensions being displayed. */ | 312 /** @return {number} The number of extensions being displayed. */ |
294 getNumExtensions: function() { | 313 getNumExtensions: function() { |
295 return this.extensions_.length; | 314 return this.extensions_.length; |
296 }, | 315 }, |
297 | 316 |
298 getIdQueryParam_: function() { | 317 getIdQueryParam_: function() { |
299 return parseQueryParams(document.location)['id']; | 318 return parseQueryParams(document.location)['id']; |
300 }, | 319 }, |
301 | 320 |
302 getOptionsQueryParam_: function() { | 321 getOptionsQueryParam_: function() { |
(...skipping 28 matching lines...) Expand all Loading... | |
331 focusableNode.getEquivalentElement( | 350 focusableNode.getEquivalentElement( |
332 document.activeElement).focus(); | 351 document.activeElement).focus(); |
333 } | 352 } |
334 } | 353 } |
335 | 354 |
336 node.parentElement.removeChild(node); | 355 node.parentElement.removeChild(node); |
337 // Unregister the removed node from events. | 356 // Unregister the removed node from events. |
338 assertInstanceof(node, ExtensionFocusRow).destroy(); | 357 assertInstanceof(node, ExtensionFocusRow).destroy(); |
339 } | 358 } |
340 } | 359 } |
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 }, | 360 }, |
350 | 361 |
351 /** Updates each row's focusable elements without rebuilding the grid. */ | 362 /** Updates each row's focusable elements without rebuilding the grid. */ |
352 updateFocusableElements: function() { | 363 updateFocusableElements: function() { |
353 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]'); | 364 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]'); |
354 for (var i = 0; i < rows.length; ++i) { | 365 for (var i = 0; i < rows.length; ++i) { |
355 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements(); | 366 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements(); |
356 } | 367 } |
357 }, | 368 }, |
358 | 369 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1057 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1]; | 1068 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1]; |
1058 this.createNode_(extension, nextExt ? $(nextExt.id) : null); | 1069 this.createNode_(extension, nextExt ? $(nextExt.id) : null); |
1059 } | 1070 } |
1060 } | 1071 } |
1061 }; | 1072 }; |
1062 | 1073 |
1063 return { | 1074 return { |
1064 ExtensionList: ExtensionList | 1075 ExtensionList: ExtensionList |
1065 }; | 1076 }; |
1066 }); | 1077 }); |
OLD | NEW |