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

Side by Side Diff: chrome/browser/resources/extensions/extension_list.js

Issue 1094553002: Revert "Speculative revert by sheriff" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 (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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
288
289 // |onUpdateFinished_| should be called after the list becomes visible
290 // in extensions.js. |resolve| is async, so |onUpdateFinished_|
291 // shouldn't be called directly.
292 this.extensionsUpdated_.then(this.onUpdateFinished_.bind(this));
293 }.bind(this)); 288 }.bind(this));
294 }.bind(this)); 289 }.bind(this));
295 return this.extensionsUpdated_; 290 return this.extensionsUpdated_;
296 }, 291 },
297 292
298 /** Updates elements that need to be visible in order to update properly. */
299 onUpdateFinished_: function() {
300 assert(!this.hidden);
301 assert(!this.parentElement.hidden);
302
303 this.updateFocusableElements();
304
305 var idToHighlight = this.getIdQueryParam_();
306 if (idToHighlight && $(idToHighlight))
307 this.scrollToNode_(idToHighlight);
308
309 var idToOpenOptions = this.getOptionsQueryParam_();
310 if (idToOpenOptions && $(idToOpenOptions))
311 this.showEmbeddedExtensionOptions_(idToOpenOptions, true);
312 },
313
314 /** @return {number} The number of extensions being displayed. */ 293 /** @return {number} The number of extensions being displayed. */
315 getNumExtensions: function() { 294 getNumExtensions: function() {
316 return this.extensions_.length; 295 return this.extensions_.length;
317 }, 296 },
318 297
319 getIdQueryParam_: function() { 298 getIdQueryParam_: function() {
320 return parseQueryParams(document.location)['id']; 299 return parseQueryParams(document.location)['id'];
321 }, 300 },
322 301
323 getOptionsQueryParam_: function() { 302 getOptionsQueryParam_: function() {
(...skipping 29 matching lines...) Expand all
353 focusableNode.getEquivalentElement( 332 focusableNode.getEquivalentElement(
354 document.activeElement).focus(); 333 document.activeElement).focus();
355 } 334 }
356 } 335 }
357 336
358 node.parentElement.removeChild(node); 337 node.parentElement.removeChild(node);
359 // Unregister the removed node from events. 338 // Unregister the removed node from events.
360 assertInstanceof(node, ExtensionFocusRow).destroy(); 339 assertInstanceof(node, ExtensionFocusRow).destroy();
361 } 340 }
362 } 341 }
342
343 var idToHighlight = this.getIdQueryParam_();
344 if (idToHighlight && $(idToHighlight))
345 this.scrollToNode_(idToHighlight);
346
347 var idToOpenOptions = this.getOptionsQueryParam_();
348 if (idToOpenOptions && $(idToOpenOptions))
349 this.showEmbeddedExtensionOptions_(idToOpenOptions, true);
363 }, 350 },
364 351
365 /** Updates each row's focusable elements without rebuilding the grid. */ 352 /** Updates each row's focusable elements without rebuilding the grid. */
366 updateFocusableElements: function() { 353 updateFocusableElements: function() {
367 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]'); 354 var rows = document.querySelectorAll('.extension-list-item-wrapper[id]');
368 for (var i = 0; i < rows.length; ++i) { 355 for (var i = 0; i < rows.length; ++i) {
369 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements(); 356 assertInstanceof(rows[i], ExtensionFocusRow).updateFocusableElements();
370 } 357 }
371 }, 358 },
372 359
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1]; 1058 var nextExt = this.extensions_[this.extensions_.indexOf(extension) + 1];
1072 this.createNode_(extension, nextExt ? $(nextExt.id) : null); 1059 this.createNode_(extension, nextExt ? $(nextExt.id) : null);
1073 } 1060 }
1074 } 1061 }
1075 }; 1062 };
1076 1063
1077 return { 1064 return {
1078 ExtensionList: ExtensionList 1065 ExtensionList: ExtensionList
1079 }; 1066 };
1080 }); 1067 });
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/blocking_login_browsertest.cc ('k') | chrome/browser/resources/extensions/extensions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698