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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * A lookup helper function to find the first node that has an id (starting | 9 * A lookup helper function to find the first node that has an id (starting |
10 * at |node| and going up the parent chain). | 10 * at |node| and going up the parent chain). |
(...skipping 14 matching lines...) Expand all Loading... | |
25 */ | 25 */ |
26 var ExtensionsList = cr.ui.define('div'); | 26 var ExtensionsList = cr.ui.define('div'); |
27 | 27 |
28 /** | 28 /** |
29 * @type {Object.<string, boolean>} A map from extension id to a boolean | 29 * @type {Object.<string, boolean>} A map from extension id to a boolean |
30 * indicating whether the incognito warning is showing. This persists | 30 * indicating whether the incognito warning is showing. This persists |
31 * between calls to decorate. | 31 * between calls to decorate. |
32 */ | 32 */ |
33 var butterBarVisibility = {}; | 33 var butterBarVisibility = {}; |
34 | 34 |
35 /** | |
36 * @type {Object.<string, string>} A map from extension id to last reloaded | |
37 * timestamp. The timestamp is recorded when the user click the 'Reload' | |
38 * link. It is used to refresh the icon of an unpacked extension. | |
39 * This persists between calls to decorate. | |
40 */ | |
41 var extensionReloadedTimestamp = {}; | |
42 | |
35 ExtensionsList.prototype = { | 43 ExtensionsList.prototype = { |
36 __proto__: HTMLDivElement.prototype, | 44 __proto__: HTMLDivElement.prototype, |
37 | 45 |
38 /** @override */ | 46 /** @override */ |
39 decorate: function() { | 47 decorate: function() { |
40 this.textContent = ''; | 48 this.textContent = ''; |
41 | 49 |
42 this.showExtensionNodes_(); | 50 this.showExtensionNodes_(); |
43 }, | 51 }, |
44 | 52 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 node.classList.add('inactive-extension'); | 98 node.classList.add('inactive-extension'); |
91 | 99 |
92 if (!extension.userModifiable) | 100 if (!extension.userModifiable) |
93 node.classList.add('may-not-disable'); | 101 node.classList.add('may-not-disable'); |
94 | 102 |
95 var idToHighlight = this.getIdQueryParam_(); | 103 var idToHighlight = this.getIdQueryParam_(); |
96 if (node.id == idToHighlight) | 104 if (node.id == idToHighlight) |
97 node.classList.add('extension-highlight'); | 105 node.classList.add('extension-highlight'); |
98 | 106 |
99 var item = node.querySelector('.extension-list-item'); | 107 var item = node.querySelector('.extension-list-item'); |
100 var extensionIconUrl = extension.icon; | 108 if (extensionReloadedTimestamp[extension.id]) { |
not at google - send to devlin
2013/08/01 15:22:01
reference bug number(s) in a comment here
zhchbin
2013/08/02 00:29:10
Done.
| |
101 if (extension.allow_reload) | 109 item.style.backgroundImage = |
102 extensionIconUrl = extension.icon + '?' + Date.now(); | 110 'url(' + extension.icon + '?' + |
103 item.style.backgroundImage = 'url(' + extensionIconUrl + ')'; | 111 extensionReloadedTimestamp[extension.id] + ')'; |
112 } else { | |
113 item.style.backgroundImage = 'url(' + extension.icon + ')'; | |
114 } | |
104 | 115 |
105 var title = node.querySelector('.extension-title'); | 116 var title = node.querySelector('.extension-title'); |
106 title.textContent = extension.name; | 117 title.textContent = extension.name; |
107 | 118 |
108 var version = node.querySelector('.extension-version'); | 119 var version = node.querySelector('.extension-version'); |
109 version.textContent = extension.version; | 120 version.textContent = extension.version; |
110 | 121 |
111 var locationText = node.querySelector('.location-text'); | 122 var locationText = node.querySelector('.location-text'); |
112 locationText.textContent = extension.locationText; | 123 locationText.textContent = extension.locationText; |
113 | 124 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 extension.homepageProvided ? 'extensionSettingsVisitWebsite' : | 186 extension.homepageProvided ? 'extensionSettingsVisitWebsite' : |
176 'extensionSettingsVisitWebStore'); | 187 'extensionSettingsVisitWebStore'); |
177 siteLink.hidden = false; | 188 siteLink.hidden = false; |
178 } | 189 } |
179 | 190 |
180 if (extension.allow_reload) { | 191 if (extension.allow_reload) { |
181 // The 'Reload' link. | 192 // The 'Reload' link. |
182 var reload = node.querySelector('.reload-link'); | 193 var reload = node.querySelector('.reload-link'); |
183 reload.addEventListener('click', function(e) { | 194 reload.addEventListener('click', function(e) { |
184 chrome.send('extensionSettingsReload', [extension.id]); | 195 chrome.send('extensionSettingsReload', [extension.id]); |
196 extensionReloadedTimestamp[extension.id] = new Date().getTime(); | |
not at google - send to devlin
2013/08/01 15:22:01
Date.now() should do it.
dhnishi (use Chromium)
2013/08/01 18:30:19
Actually, I just had a thought.
Suppose an extens
not at google - send to devlin
2013/08/01 18:46:18
The same would apply for the developerPrivate API
zhchbin
2013/08/02 00:29:10
Done.
| |
185 }); | 197 }); |
186 reload.hidden = false; | 198 reload.hidden = false; |
187 | 199 |
188 if (extension.is_platform_app) { | 200 if (extension.is_platform_app) { |
189 // The 'Launch' link. | 201 // The 'Launch' link. |
190 var launch = node.querySelector('.launch-link'); | 202 var launch = node.querySelector('.launch-link'); |
191 launch.addEventListener('click', function(e) { | 203 launch.addEventListener('click', function(e) { |
192 chrome.send('extensionSettingsLaunch', [extension.id]); | 204 chrome.send('extensionSettingsLaunch', [extension.id]); |
193 }); | 205 }); |
194 launch.hidden = false; | 206 launch.hidden = false; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 topScroll -= pad / 2; | 339 topScroll -= pad / 2; |
328 document.body.scrollTop = topScroll; | 340 document.body.scrollTop = topScroll; |
329 } | 341 } |
330 } | 342 } |
331 }; | 343 }; |
332 | 344 |
333 return { | 345 return { |
334 ExtensionsList: ExtensionsList | 346 ExtensionsList: ExtensionsList |
335 }; | 347 }; |
336 }); | 348 }); |
OLD | NEW |