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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'bookmarks-app', 6 is: 'bookmarks-app',
7 7
8 behaviors: [ 8 behaviors: [
9 bookmarks.StoreClient, 9 bookmarks.StoreClient,
10 ], 10 ],
11 11
12 properties: {
13 /** @private */
14 searchTerm_: {
15 type: String,
16 observer: 'searchTermChanged_',
17 },
18 },
19
12 /** @override */ 20 /** @override */
13 attached: function() { 21 attached: function() {
22 this.watch('searchTerm_', function(store) {
23 return store.search.term;
24 });
25
14 chrome.bookmarks.getTree(function(results) { 26 chrome.bookmarks.getTree(function(results) {
15 var nodeList = bookmarks.util.normalizeNodes(results[0]); 27 var nodeList = bookmarks.util.normalizeNodes(results[0]);
16 var initialState = bookmarks.util.createEmptyState(); 28 var initialState = bookmarks.util.createEmptyState();
17 initialState.nodes = nodeList; 29 initialState.nodes = nodeList;
18 initialState.selectedFolder = nodeList['0'].children[0]; 30 initialState.selectedFolder = nodeList['0'].children[0];
19 31
20 bookmarks.Store.getInstance().init(initialState); 32 bookmarks.Store.getInstance().init(initialState);
21 bookmarks.ApiListener.init(); 33 bookmarks.ApiListener.init();
22 }.bind(this)); 34 }.bind(this));
23 }, 35 },
36
37 searchTermChanged_: function() {
38 if (!this.searchTerm_)
39 return;
40
41 chrome.bookmarks.search(this.searchTerm_, function(results) {
42 var ids = results.map(function(node) {
43 return node.id;
44 });
45 this.dispatch(bookmarks.actions.setSearchResults(ids));
46 }.bind(this));
47 },
24 }); 48 });
OLDNEW
« 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