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

Unified Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 6990063: ntp4: fix brokeness when new apps are added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
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 2fc508e63801ff44af9d7b4c578f58db47d25365..0f66a8f3c464494226e56b64d5f0a7fc983d7717 100644
--- a/chrome/browser/resources/ntp4/new_tab.js
+++ b/chrome/browser/resources/ntp4/new_tab.js
@@ -79,12 +79,6 @@ cr.define('ntp4', function() {
var DEFAULT_TRANSITION_TIME = 500;
/**
- * All the Grabber objects currently in use on the page
- * @type {Array.<Grabber>}
- */
- var grabbers = [];
-
- /**
* Invoked at startup once the DOM is available to initialize the app.
*/
function initialize() {
@@ -217,29 +211,13 @@ cr.define('ntp4', function() {
* applications.
*/
function getAppsCallback(data) {
- // Clean up any existing grabber objects - cancelling any outstanding drag.
- // Ideally an async app update wouldn't disrupt an active drag but
- // that would require us to re-use existing elements and detect how the apps
- // have changed, which would be a lot of work.
- // Note that we have to explicitly clean up the grabber objects so they stop
- // listening to events and break the DOM<->JS cycles necessary to enable
- // collection of all these objects.
- grabbers.forEach(function(g) {
- // Note that this may raise DRAG_END/RELEASE events to clean up an
- // oustanding drag.
- g.dispose();
- });
- assert(!draggingAppContainer && !draggingAppOriginalPosition &&
- !draggingAppOriginalPage);
- grabbers = [];
-
// Clear any existing apps pages and dots.
// TODO(rbyers): It might be nice to preserve animation of dots after an
// uninstall. Could we re-use the existing page and dot elements? It seems
// unfortunate to have Chrome send us the entire apps list after an
// uninstall.
- for (var i = 0; i < appsPages.length; i++) {
- var page = appsPages[i];
+ while (appsPages.length > 0) {
+ var page = appsPages[0];
var dot = page.navigationDot;
page.tearDown();
@@ -344,7 +322,6 @@ cr.define('ntp4', function() {
pageList.appendChild(page);
// Make a deep copy of the dot template to add a new one.
- var dotCount = dots.length;
var newDot = dotTemplate.cloneNode(true);
newDot.querySelector('span').textContent = page.pageName;
if (opt_animate)
@@ -353,7 +330,7 @@ cr.define('ntp4', function() {
page.navigationDot = newDot;
newDot.showPage = function() {
- cardSlider.selectCard(dotCount, true);
+ cardSlider.selectCardByValue(page, true);
};
function switchPage(e) {
newDot.showPage();
« chrome/browser/resources/ntp4/card_slider.js ('K') | « chrome/browser/resources/ntp4/card_slider.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698