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

Unified Diff: chrome/browser/resources/md_bookmarks/store.js

Issue 2715523003: [MD Bookmarks] Add import/export bookmarks HTML features (Closed)
Patch Set: Created 3 years, 10 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 | chrome/browser/resources/md_bookmarks/toolbar.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/store.js
diff --git a/chrome/browser/resources/md_bookmarks/store.js b/chrome/browser/resources/md_bookmarks/store.js
index eb4cb11c7a3cab9825505dd03faceb876fb8ba14..e90183cabb37323bee3b5ea9470fc920938fd4fa 100644
--- a/chrome/browser/resources/md_bookmarks/store.js
+++ b/chrome/browser/resources/md_bookmarks/store.js
@@ -79,6 +79,8 @@ var BookmarksStore = Polymer({
// Attach bookmarks API listeners.
chrome.bookmarks.onRemoved.addListener(this.onBookmarkRemoved_.bind(this));
chrome.bookmarks.onChanged.addListener(this.onBookmarkChanged_.bind(this));
+ chrome.bookmarks.onImportBegan.addListener(this.onImportBegan_.bind(this));
+ chrome.bookmarks.onImportEnded.addListener(this.onImportEnded_.bind(this));
},
//////////////////////////////////////////////////////////////////////////////
@@ -326,6 +328,26 @@ var BookmarksStore = Polymer({
this.updateSearchDisplay_();
},
+ /**
+ * Called when importing bookmark is started.
+ */
+ onImportBegan_: function() {
+ chrome.bookmarks.onRemoved.removeListener(this.onBookmarkRemoved_.bind(this));
tsergeant 2017/02/24 00:03:18 The docs for importBegan say: "Expensive observer
rongjie 2017/02/24 00:20:46 Done.
+ chrome.bookmarks.onChanged.removeListener(this.onBookmarkChanged_.bind(this));
+ },
+
+ /**
+ * Called when importing bookmark node is finished.
+ */
+ onImportEnded_: function() {
+ chrome.bookmarks.getTree(function(results) {
+ this.setupStore_(results[0]);
tsergeant 2017/02/24 00:03:18 I think you need to call this.updateSelectedDispl
rongjie 2017/02/24 00:20:46 Done.
+ }.bind(this));
+
+ chrome.bookmarks.onRemoved.addListener(this.onBookmarkRemoved_.bind(this));
+ chrome.bookmarks.onChanged.addListener(this.onBookmarkChanged_.bind(this));
+ },
+
//////////////////////////////////////////////////////////////////////////////
// bookmarks-store, bookmarks app event listeners:
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/toolbar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698