OLD | NEW |
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 ], |
(...skipping 18 matching lines...) Expand all Loading... |
29 /** @override */ | 29 /** @override */ |
30 attached: function() { | 30 attached: function() { |
31 this.watch('searchTerm_', function(store) { | 31 this.watch('searchTerm_', function(store) { |
32 return store.search.term; | 32 return store.search.term; |
33 }); | 33 }); |
34 | 34 |
35 chrome.bookmarks.getTree(function(results) { | 35 chrome.bookmarks.getTree(function(results) { |
36 var nodeList = bookmarks.util.normalizeNodes(results[0]); | 36 var nodeList = bookmarks.util.normalizeNodes(results[0]); |
37 var initialState = bookmarks.util.createEmptyState(); | 37 var initialState = bookmarks.util.createEmptyState(); |
38 initialState.nodes = nodeList; | 38 initialState.nodes = nodeList; |
39 initialState.selectedFolder = | 39 initialState.selectedFolder = nodeList[ROOT_NODE_ID].children[0]; |
40 nodeList[bookmarks.util.ROOT_NODE_ID].children[0]; | 40 var closedFoldersString = |
| 41 window.localStorage[LOCAL_STORAGE_CLOSED_FOLDERS_KEY]; |
| 42 initialState.closedFolders = closedFoldersString ? |
| 43 /** @type {!Object<string,boolean>} */ ( |
| 44 JSON.parse(closedFoldersString)) : |
| 45 {}; |
41 | 46 |
42 bookmarks.Store.getInstance().init(initialState); | 47 bookmarks.Store.getInstance().init(initialState); |
43 bookmarks.ApiListener.init(); | 48 bookmarks.ApiListener.init(); |
44 | 49 |
45 }.bind(this)); | 50 }.bind(this)); |
46 | 51 |
47 this.boundUpdateSidebarWidth_ = this.updateSidebarWidth_.bind(this); | 52 this.boundUpdateSidebarWidth_ = this.updateSidebarWidth_.bind(this); |
48 | 53 |
49 this.initializeSplitter_(); | 54 this.initializeSplitter_(); |
50 | 55 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return; | 97 return; |
93 | 98 |
94 chrome.bookmarks.search(this.searchTerm_, function(results) { | 99 chrome.bookmarks.search(this.searchTerm_, function(results) { |
95 var ids = results.map(function(node) { | 100 var ids = results.map(function(node) { |
96 return node.id; | 101 return node.id; |
97 }); | 102 }); |
98 this.dispatch(bookmarks.actions.setSearchResults(ids)); | 103 this.dispatch(bookmarks.actions.setSearchResults(ids)); |
99 }.bind(this)); | 104 }.bind(this)); |
100 }, | 105 }, |
101 }); | 106 }); |
OLD | NEW |