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

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

Issue 2960143002: MD Bookmarks: Remove '/?id=1' from URL when displaying Bookmarks Bar (Closed)
Patch Set: Review comments Created 3 years, 5 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/router.html ('k') | chrome/browser/resources/md_bookmarks/util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/router.js
diff --git a/chrome/browser/resources/md_bookmarks/router.js b/chrome/browser/resources/md_bookmarks/router.js
index 2634fb32157b391a9bdafe884a755c145204af6e..431331e62b1347f226b6d69941be5084223ba378 100644
--- a/chrome/browser/resources/md_bookmarks/router.js
+++ b/chrome/browser/resources/md_bookmarks/router.js
@@ -23,15 +23,17 @@ Polymer({
queryParams_: Object,
/** @private */
- searchTerm_: String,
+ searchTerm_: {
+ type: String,
+ value: '',
+ },
/** @private {?string} */
selectedId_: String,
},
observers: [
- 'onQueryChanged_(queryParams_.q)',
- 'onFolderChanged_(queryParams_.id)',
+ 'onQueryParamsChanged_(queryParams_)',
'onStateChanged_(searchTerm_, selectedId_)',
],
@@ -46,17 +48,17 @@ Polymer({
},
/** @private */
- onQueryChanged_: function() {
+ onQueryParamsChanged_: function() {
var searchTerm = this.queryParams_.q || '';
- if (searchTerm && searchTerm != this.searchTerm_) {
+ var selectedId = this.queryParams_.id;
+ if (!selectedId && !searchTerm)
+ selectedId = BOOKMARKS_BAR_ID;
+
+ if (searchTerm != this.searchTerm_) {
this.searchTerm_ = searchTerm;
this.dispatch(bookmarks.actions.setSearchTerm(searchTerm));
}
- },
- /** @private */
- onFolderChanged_: function() {
- var selectedId = this.queryParams_.id;
if (selectedId && selectedId != this.selectedId_) {
this.selectedId_ = selectedId;
// Need to dispatch a deferred action so that during page load
@@ -77,7 +79,9 @@ Polymer({
updateQueryParams_: function() {
if (this.searchTerm_)
this.queryParams_ = {q: this.searchTerm_};
- else
+ else if (this.selectedId_ != BOOKMARKS_BAR_ID)
this.queryParams_ = {id: this.selectedId_};
+ else
+ this.queryParams_ = {};
},
});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/router.html ('k') | chrome/browser/resources/md_bookmarks/util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698