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

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

Issue 2740863003: MD Bookmarks: Implement search and selection in new data flow system (Closed)
Patch Set: Review round 2 Created 3 years, 9 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/md_bookmarks/app.js
diff --git a/chrome/browser/resources/md_bookmarks/app.js b/chrome/browser/resources/md_bookmarks/app.js
index 23bb4984359987ce975042b8e94972673d61d652..026fc9c643241198206edde1f80f2552019252ce 100644
--- a/chrome/browser/resources/md_bookmarks/app.js
+++ b/chrome/browser/resources/md_bookmarks/app.js
@@ -9,8 +9,20 @@ Polymer({
bookmarks.StoreClient,
],
+ properties: {
+ /** @private */
+ searchTerm_: {
+ type: String,
+ observer: 'searchTermChanged_',
+ },
+ },
+
/** @override */
attached: function() {
+ this.watch('searchTerm_', function(store) {
+ return store.search.term;
+ });
+
chrome.bookmarks.getTree(function(results) {
var nodeList = bookmarks.util.normalizeNodes(results[0]);
var initialState = bookmarks.util.createEmptyState();
@@ -21,4 +33,16 @@ Polymer({
bookmarks.ApiListener.init();
}.bind(this));
},
+
+ searchTermChanged_: function() {
+ if (!this.searchTerm_)
+ return;
+
+ chrome.bookmarks.search(this.searchTerm_, function(results) {
+ var ids = results.map(function(node) {
+ return node.id;
+ });
+ this.dispatch(bookmarks.actions.setSearchResults(ids));
+ }.bind(this));
+ },
});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/actions.js ('k') | chrome/browser/resources/md_bookmarks/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698