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

Unified Diff: chrome/browser/resources/extensions/extension_list.js

Issue 1090763003: Fix scroll regression when specifying an extension id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bind + comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extensions.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/extensions/extension_list.js
diff --git a/chrome/browser/resources/extensions/extension_list.js b/chrome/browser/resources/extensions/extension_list.js
index f6967bd6297656b638d75cb63c44064ba79773fc..7399025d8dfb6dd8edf9425be5e8183b5cf24f26 100644
--- a/chrome/browser/resources/extensions/extension_list.js
+++ b/chrome/browser/resources/extensions/extension_list.js
@@ -235,6 +235,16 @@ cr.define('extensions', function() {
/** @private {!Array<ExtensionInfo>} */
this.extensions_ = [];
+ /**
+ * |loadFinished| should be used for testing purposes and will be
+ * fulfilled when this list has finished loading the first time.
+ * @type {Promise}
+ * */
+ this.loadFinished = new Promise(function(resolve, reject) {
+ /** @private {function(?)} */
+ this.onLoadFinish_ = resolve;
+ }.bind(this));
+
chrome.developerPrivate.onItemStateChanged.addListener(
function(eventData) {
var EventType = chrome.developerPrivate.EventType;
@@ -285,11 +295,40 @@ cr.define('extensions', function() {
this.extensions_ = extensions;
this.showExtensionNodes_();
resolve();
+
+ // |resolve| is async so it's necessary to use |then| here in order to
+ // do work after other |then|s have finished.
+ this.extensionsUpdated_.then(function() {
+ // |onUpdateFinished_| should be called after the list becomes
+ // visible in extensions.js.
+ if (extensions.length > 0)
+ this.onUpdateFinished_();
not at google - send to devlin 2015/04/17 21:50:11 Whether or not there are >0 extensions, the update
hcarmona 2015/04/17 22:43:44 Done.
+
+ // |onLoadFinish_| will resolve the |loadFinished| promise for
+ // testing purposes.
+ this.onLoadFinish_();
+ }.bind(this));
}.bind(this));
}.bind(this));
return this.extensionsUpdated_;
},
+ /** Updates elements that need to be visible in order to update properly. */
+ onUpdateFinished_: function() {
+ assert(!this.hidden);
+ assert(!this.parentElement.hidden);
+
+ this.updateFocusableElements();
+
+ var idToHighlight = this.getIdQueryParam_();
+ if (idToHighlight && $(idToHighlight))
+ this.scrollToNode_(idToHighlight);
+
+ var idToOpenOptions = this.getOptionsQueryParam_();
+ if (idToOpenOptions && $(idToOpenOptions))
+ this.showEmbeddedExtensionOptions_(idToOpenOptions, true);
+ },
+
/** @return {number} The number of extensions being displayed. */
getNumExtensions: function() {
return this.extensions_.length;
@@ -339,14 +378,6 @@ cr.define('extensions', function() {
assertInstanceof(node, ExtensionFocusRow).destroy();
}
}
-
- var idToHighlight = this.getIdQueryParam_();
- if (idToHighlight && $(idToHighlight))
- this.scrollToNode_(idToHighlight);
-
- var idToOpenOptions = this.getOptionsQueryParam_();
- if (idToOpenOptions && $(idToOpenOptions))
- this.showEmbeddedExtensionOptions_(idToOpenOptions, true);
},
/** Updates each row's focusable elements without rebuilding the grid. */
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extensions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698