Index: chrome/browser/resources/ntp4/bookmarks_page.js |
=================================================================== |
--- chrome/browser/resources/ntp4/bookmarks_page.js (revision 99893) |
+++ chrome/browser/resources/ntp4/bookmarks_page.js (working copy) |
@@ -300,6 +300,9 @@ |
} else { |
wrapper.hidden = true; |
} |
+ |
+ if (this.id === ROOT_NODE_ID && !tile_count) |
+ this.showImportPromo_(); |
}, |
/** |
@@ -368,6 +371,8 @@ |
bookmarkNodeAdded: function(id, bookmark, fromCurrentPage) { |
if (this.importing) return; |
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); |
@@ -543,6 +548,28 @@ |
}, |
/** |
+ * Show the 'Import bookmarks' promo |
Evan Stade
2011/09/07 19:16:18
.
csilv
2011/09/07 19:29:59
Done.
|
+ * @private |
+ */ |
+ showImportPromo_: function() { |
+ var importTemplate = $('bookmarks-import-data-link-template'); |
+ var importWrapper = importTemplate.cloneNode(true); |
+ importWrapper.id = ''; |
+ importWrapper.hidden = false; |
+ this.querySelector('.tile-page-content').appendChild(importWrapper); |
+ }, |
+ |
+ /** |
+ * Hide the 'Import bookmarks' promo |
Evan Stade
2011/09/07 19:16:18
.
csilv
2011/09/07 19:29:59
Done.
|
+ * @private |
+ */ |
+ hideImportPromo_: function() { |
+ var wrapper = this.querySelector('.bookmarks-import-data-link-wrapper'); |
+ if (wrapper) |
+ wrapper.parentNode.removeChild(wrapper); |
+ }, |
+ |
+ /** |
* Create a bookmark from a title/url. |
* @param {!string} parentId Stringified int64 of the parent node's ID. |
* @param {number} index Sibling relative index, i.e. 3rd on this level. |