Chromium Code Reviews| 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 baddea20b2e1979feb20095a57cae3ba320e3edd..f73cd546a3248de2df125862573d0d86df78351f 100644 |
| --- a/chrome/browser/resources/md_bookmarks/store.js |
| +++ b/chrome/browser/resources/md_bookmarks/store.js |
| @@ -75,6 +75,11 @@ var BookmarksStore = Polymer({ |
| //////////////////////////////////////////////////////////////////////////////// |
| // bookmarks-store, private: |
| + /** @return {BookmarksRouterElement} */ |
| + get router() { |
| + return /** @type {BookmarksRouterElement} */ (this.$$('bookmarks-router')); |
| + }, |
|
jiaxi
2017/01/17 05:19:02
I have a feeling that this shouldn't be in the pri
angelayang
2017/01/17 05:36:03
Yeah true, i didn't annotate as private either- i'
calamity
2017/01/18 03:37:21
Yeah, move it up above intialize-store and make a
angelayang
2017/01/18 06:34:02
Done.
|
| + |
| /** |
| * @param {BookmarkTreeNode} rootNode |
| * @private |
| @@ -85,7 +90,15 @@ var BookmarksStore = Polymer({ |
| this.rootNode.path = 'rootNode'; |
| BookmarksStore.generatePaths(rootNode, 0); |
| BookmarksStore.initNodes(this.rootNode, this.idToNodeMap_); |
| - this.fire('selected-folder-changed', this.rootNode.children[0].id); |
| + |
| + // Check for a selectedId from the router. |
|
calamity
2017/01/18 03:37:21
// Initialize the store's fields from the router.
angelayang
2017/01/18 06:34:03
Done.
|
| + if (this.router.selectedId) { |
| + this.fire('selected-folder-changed', this.router.selectedId); |
| + } else if (this.router.searchTerm) { |
| + this.searchTerm = this.router.searchTerm; |
|
calamity
2017/01/18 03:37:21
Hrmmmmm. How hard is it to make it so that selecte
angelayang
2017/01/18 06:34:03
Discussed: Will do this in follow up patch.
|
| + } else { |
| + this.fire('selected-folder-changed', this.rootNode.children[0].id); |
| + } |
| }, |
| /** @private */ |
| @@ -110,7 +123,7 @@ var BookmarksStore = Polymer({ |
| /** @private */ |
| updateSearchDisplay_: function() { |
| - if (this.searchTerm == '') { |
| + if (!this.searchTerm) { |
| this.fire('selected-folder-changed', this.rootNode.children[0].id); |
| } else { |
| chrome.bookmarks.search(this.searchTerm, function(results) { |