Chromium Code Reviews| 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 df176032abc0cfbf2bcb33893f356f5d0b61b31e..1f1a5f500cc8ad61af9da3d244cf484c160bbb6a 100644 |
| --- a/chrome/browser/resources/ntp4/new_tab.js |
| +++ b/chrome/browser/resources/ntp4/new_tab.js |
| @@ -347,11 +347,10 @@ cr.define('ntp4', function() { |
| * app. |
| */ |
| function appAdded(app, opt_highlight) { |
| - // If the page is already open when a new app is installed, the hash will |
| - // be set once again. |
| - var appID = getAndClearAppIDHash(); |
| - if (appID == app.id) |
| + if (app.id == highlightAppId) { |
| opt_highlight = true; |
| + highlightAppId = null; |
| + } |
| var pageIndex = app.page_index || 0; |
| @@ -363,9 +362,15 @@ cr.define('ntp4', function() { |
| } |
| var page = appsPages[pageIndex]; |
| - if (opt_highlight) |
| - cardSlider.selectCardByValue(page); |
| - page.appendApp(app, true); |
| + page.appendApp(app, opt_highlight); |
| + } |
| + |
| + /** |
| + * Sets that an app should be highlighted if it is added. Called right before |
| + * appAdded for new installs. |
| + */ |
| + function setAppToBeHighlighted(appId) { |
| + highlightAppId = appId; |
|
Rick Byers
2011/08/29 16:01:00
Should you perhaps assert that highlightAppId is n
Evan Stade
2011/08/29 18:15:16
yea I assume it's possible if unlikely to have a r
Rick Byers
2011/08/29 19:51:12
Yeah, I guess the race potential and highlight-las
|
| } |
| /** |
| @@ -775,6 +780,7 @@ cr.define('ntp4', function() { |
| isRTL: isRTL, |
| leaveRearrangeMode: leaveRearrangeMode, |
| saveAppPageName: saveAppPageName, |
| + setAppToBeHighlighted: setAppToBeHighlighted, |
| setBookmarksData: setBookmarksData, |
| setMostVisitedPages: setMostVisitedPages, |
| setRecentlyClosedTabs: setRecentlyClosedTabs, |