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

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

Issue 7980061: [ntp4] Handle max tile limit properly when adding bookmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review tweak Created 9 years, 3 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/ntp4/bookmarks_page.js
===================================================================
--- chrome/browser/resources/ntp4/bookmarks_page.js (revision 102206)
+++ chrome/browser/resources/ntp4/bookmarks_page.js (working copy)
@@ -384,10 +384,19 @@
if (this.currentlyInFolder_(bookmark.parentId)) {
// Hide the import promo if it exists.
this.hideImportPromo_();
- // If source of the add came from this page, show an animated insertion,
- // otherwise just quietly do it.
- this.addTileAt(new Bookmark(bookmark), bookmark.index, fromCurrentPage);
- this.repositionTiles_();
+ // Only add the item if it should be visible.
+ if (bookmark.index < MAX_BOOKMARK_TILES) {
+ // If source of the add came from this page, show an animated
+ // insertion, otherwise just quietly do it.
+ this.addTileAt(new Bookmark(bookmark), bookmark.index,
+ fromCurrentPage);
+ // Delete extra tiles if they exist.
+ while (this.tiles.length > MAX_BOOKMARK_TILES) {
+ var tile = this.tiles[this.tiles.length - 1];
+ this.removeTile(tile, false);
+ }
+ this.repositionTiles_();
+ }
}
},
« 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