Index: chrome/browser/resources/ntp4/new_tab.js |
diff --git a/chrome/browser/resources/ntp4/new_tab.js b/chrome/browser/resources/ntp4/new_tab.js |
index b47c4018de46c1ce19e0b1784b9f6c38b4b48c75..98631ac0a8633adc24abf240fb194b43402cf7f0 100644 |
--- a/chrome/browser/resources/ntp4/new_tab.js |
+++ b/chrome/browser/resources/ntp4/new_tab.js |
@@ -245,14 +245,21 @@ cr.define('ntp4', function() { |
/** |
* Callback invoked by chrome whenever an app preference changes. |
- * The normal NTP uses this to keep track of the current launch-type of an |
- * app, updating the choices in the context menu. We don't have such a menu |
- * so don't use this at all (but it still needs to be here for chrome to |
- * call). |
* @param {Object} data An object with all the data on available |
- * applications. |
+ * applications. |
*/ |
function appsPrefChangeCallback(data) { |
+ var apps = document.querySelectorAll('.app'); |
+ |
+ // This is an expensive operation. We minimize how frequently it's called |
+ // by only calling it for changes across different instances of the NTP |
+ // (i.e. two separate tabs both showing NTP). |
+ for (var j = 0; j < data.apps.length; ++j) { |
+ for (var i = 0; i < apps.length; ++i) { |
+ if (data.apps[j]['id'] == apps[i].appId) |
+ apps[i].appData = data.apps[j]; |
+ } |
+ } |
} |
function getCardSlider() { |