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

Unified Diff: ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js

Issue 2004263002: [Do not commit] MD History: Experimentally implement cr-toolbar using cr-search-field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
new file mode 100644
index 0000000000000000000000000000000000000000..e978e9d512f7e701bf2ad077acbfd4e1e7f6b99b
--- /dev/null
+++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'cr-toolbar',
+
+ properties: {
+ // Name to display in the toolbar, in titlecase.
+ pageName: String,
+ // Prompt text to display in the search field.
+ searchPrompt: String,
+ // Tooltip to display on the clear search button.
+ clearLabel: String,
+
+ showingSearch_: {
+ type: Boolean,
+ reflectToAttribute: true
+ }
+ },
+
+ /** @private */
+ onInputBlur_: function() {
+ if (!this.hasSearchText_)
+ this.showingSearch_ = false;
+ },
+
+ /** @private */
+ onMenuClick_: function(e) {
+ this.fire('cr-toolbar-menu-click');
+ },
+
+ /**
+ * @param {Event} e
+ * @private
+ */
+ showSearch_: function(e) {
+ if (e.target != this.$.clearSearch)
+ this.showingSearch_ = true;
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698