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

Side by Side Diff: chrome/browser/resources/md_bookmarks/router.js

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: Add positive test case Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 /** 6 /**
7 * This element is a one way bound interface that routes the page URL to 7 * This element is a one way bound interface that routes the page URL to
8 * the searchTerm and selectedId. Clients must initialize themselves by 8 * the searchTerm and selectedId. Clients must initialize themselves by
9 * reading the router's fields after attach. 9 * reading the router's fields after attach.
10 */ 10 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 this.searchTerm_ = searchTerm; 51 this.searchTerm_ = searchTerm;
52 this.dispatch(bookmarks.actions.setSearchTerm(searchTerm)); 52 this.dispatch(bookmarks.actions.setSearchTerm(searchTerm));
53 } 53 }
54 }, 54 },
55 55
56 /** @private */ 56 /** @private */
57 onFolderChanged_: function() { 57 onFolderChanged_: function() {
58 var selectedId = this.queryParams_.id; 58 var selectedId = this.queryParams_.id;
59 if (selectedId && selectedId != this.selectedId_) { 59 if (selectedId && selectedId != this.selectedId_) {
60 this.selectedId_ = selectedId; 60 this.selectedId_ = selectedId;
61 this.dispatch(bookmarks.actions.selectFolder(selectedId)); 61 this.dispatch(
62 bookmarks.actions.selectFolder(selectedId, this.getState().nodes));
62 } 63 }
63 }, 64 },
64 65
65 /** @private */ 66 /** @private */
66 onStateChanged_: function() { 67 onStateChanged_: function() {
67 this.debounce('updateQueryParams', this.updateQueryParams_.bind(this)); 68 this.debounce('updateQueryParams', this.updateQueryParams_.bind(this));
68 }, 69 },
69 70
70 /** @private */ 71 /** @private */
71 updateQueryParams_: function() { 72 updateQueryParams_: function() {
72 if (this.searchTerm_) 73 if (this.searchTerm_)
73 this.queryParams_ = {q: this.searchTerm_}; 74 this.queryParams_ = {q: this.searchTerm_};
74 else 75 else
75 this.queryParams_ = {id: this.selectedId_}; 76 this.queryParams_ = {id: this.selectedId_};
76 }, 77 },
77 }); 78 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698