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

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

Issue 2280513002: MD History: promote menu button to show clear browsing data in narrow mode (Closed)
Patch Set: damn it Created 4 years, 3 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 | « ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 3a1cfd82611a4f1c22a6b2aa85edc973cb9bdf93..d69e634e6efad675b2df266494ae744f1951f205 100644
--- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
+++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
@@ -18,6 +18,10 @@ Polymer({
// Tooltip to display on the menu button.
menuLabel: String,
+ // Promotional toolstip string, shown in narrow mode if showMenuPromo is
+ // true.
+ menuPromo: String,
+
// Value is proxied through to cr-toolbar-search-field. When true,
// the search field will show a processing spinner.
spinnerActive: Boolean,
@@ -28,6 +32,14 @@ Polymer({
value: false
},
+ // Whether to show menu promo tooltip.
+ showMenuPromo: {
+ type: Boolean,
+ value: false,
+ },
+
+ closeMenuPromo: String,
+
/** @private */
narrow_: {
type: Boolean,
@@ -41,13 +53,47 @@ Polymer({
},
},
+ observers: [
+ 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)',
+ ],
+
/** @return {!CrToolbarSearchFieldElement} */
getSearchField: function() {
return this.$.search;
},
/** @private */
- onMenuTap_: function(e) {
+ onClosePromoTap_: function() {
+ this.showMenuPromo = false;
+ },
+
+ /** @private */
+ onMenuTap_: function() {
this.fire('cr-menu-tap');
- }
+ this.onClosePromoTap_();
+ },
+
+ /** @private */
+ possiblyShowMenuPromo_: function() {
+ Polymer.RenderStatus.afterNextRender(this, function() {
+ if (this.showMenu && this.showMenuPromo && !this.showingSearch_) {
+ this.$$('#menuPromo').animate({
+ opacity: [0, .9],
+ }, /** @type {!KeyframeEffectOptions} */({
+ duration: 500,
+ fill: 'forwards'
+ }));
+ this.fire('cr-menu-promo-shown');
+ }
+ }.bind(this));
+ },
+
+ /**
+ * @param {string} title
+ * @param {boolean} showMenuPromo
+ * @return {string} The title if the menu promo isn't showing, else "".
+ */
+ titleIfNotShowMenuPromo_: function(title, showMenuPromo) {
+ return showMenuPromo ? '' : title;
+ },
});
« no previous file with comments | « ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698