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

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

Issue 2614703003: [MD Bookmarks] Add search. (Closed)
Patch Set: Merge and fix closure. Created 3 years, 11 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
Index: chrome/browser/resources/md_bookmarks/toolbar.js
diff --git a/chrome/browser/resources/md_bookmarks/toolbar.js b/chrome/browser/resources/md_bookmarks/toolbar.js
index b1d982c2360b9bbe9fc3e0ad2745a8b36eef10b5..bfce3d0d8f86bb4c8c9432a5d8be00d5d7cb5263 100644
--- a/chrome/browser/resources/md_bookmarks/toolbar.js
+++ b/chrome/browser/resources/md_bookmarks/toolbar.js
@@ -5,6 +5,19 @@
Polymer({
is: 'bookmarks-toolbar',
+ properties: {
+ searchTerm: {
+ type: String,
+ observer: 'onSearchTermChanged_',
+ },
+ },
+
+ /** @return {CrToolbarSearchFieldElement} */
+ get searchField() {
+ return /** @type {CrToolbarElement} */ (this.$$('cr-toolbar'))
+ .getSearchField();
+ },
+
/**
* @param {Event} e
* @private
@@ -43,5 +56,20 @@ Polymer({
closeDropdownMenu_: function() {
var menu = /** @type {!CrActionMenuElement} */ (this.$.dropdown);
menu.close();
- }
+ },
+
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onSearchChanged_: function(e) {
+ var searchTerm = /** @type {string} */ (e.detail);
+ this.fire('search-term-changed', searchTerm);
+ },
+
+ /** @private */
+ onSearchTermChanged_: function() {
+ if (!this.searchTerm)
+ this.searchField.setValue('');
+ },
});

Powered by Google App Engine
This is Rietveld 408576698