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

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

Issue 20728002: Fix issue: icons for the apps are flickering while launching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments. Created 7 years, 5 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 | no next file » | 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 f6cd1b2de46f33b46897220571b09ea9a667115f..0e0f694b64ab7aef40b0a8472a60bd2dc2d04eaa 100644
--- a/chrome/browser/resources/extensions/extension_list.js
+++ b/chrome/browser/resources/extensions/extension_list.js
@@ -32,6 +32,14 @@ cr.define('options', function() {
*/
var butterBarVisibility = {};
+ /**
+ * @type {Object.<string, string>} A map from extension id to last reloaded
+ * timestamp. The timestamp is recorded when the user click the 'Reload'
+ * link. It is used to refresh the icon of an unpacked extension.
+ * This persists between calls to decorate.
+ */
+ var extensionReloadedTimestamp = {};
+
ExtensionsList.prototype = {
__proto__: HTMLDivElement.prototype,
@@ -97,10 +105,16 @@ cr.define('options', function() {
node.classList.add('extension-highlight');
var item = node.querySelector('.extension-list-item');
- var extensionIconUrl = extension.icon;
- if (extension.allow_reload)
- extensionIconUrl = extension.icon + '?' + Date.now();
- item.style.backgroundImage = 'url(' + extensionIconUrl + ')';
+ // Prevent the image cache of extension icon by using the reloaded
+ // timestamp as a query string. The timestamp is recorded when the user
+ // clicks the 'Reload' link. http://crbug.com/159302.
+ if (extensionReloadedTimestamp[extension.id]) {
+ item.style.backgroundImage =
+ 'url(' + extension.icon + '?' +
+ extensionReloadedTimestamp[extension.id] + ')';
+ } else {
+ item.style.backgroundImage = 'url(' + extension.icon + ')';
+ }
var title = node.querySelector('.extension-title');
title.textContent = extension.name;
@@ -182,6 +196,7 @@ cr.define('options', function() {
var reload = node.querySelector('.reload-link');
reload.addEventListener('click', function(e) {
chrome.send('extensionSettingsReload', [extension.id]);
+ extensionReloadedTimestamp[extension.id] = Date.now();
});
reload.hidden = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698