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

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

Issue 1963503002: MD WebUI: Add shared cr-toolbar element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor tweaks 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..abcc0d525e9ad04d442880dbeb15fa2a0daa3d5a
--- /dev/null
+++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
@@ -0,0 +1,32 @@
+// 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',
+
+ behaviors: [CrSearchFieldBehavior],
+
+ 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,
+ },
+
+ onInputBlur_: function(e) {
+ if (!this.hasSearchText_)
+ this.showingSearch_ = false;
+ },
+
+ showSearch_: function(e) {
+ if (e.target != this.$['clear-search'])
dpapad 2016/05/18 23:39:13 Nit (optional): Change id to clearSearch, such tha
tsergeant 2016/05/19 07:11:55 I was sticking with the style used in cr-search-fi
+ this.showingSearch_ = true;
+ },
+
+ computeLowerPageName_: function(name) {
dpapad 2016/05/18 23:39:14 Type annotations for parameter and return value mi
tsergeant 2016/05/19 07:11:55 oops, that function is dead code. So, uh Done.
+ return name.toLowerCase();
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698