Chromium Code Reviews| 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..86a77e3e82803eb12b4b66a6d903025648634314 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,46 @@ 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_) { |
|
tsergeant
2016/09/19 01:21:41
this.fire('cr-menu-promo-shown');
disappeared fro
Dan Beam
2016/09/20 00:53:35
Done.
|
| + this.$$('#menuPromo').animate({ |
| + opacity: [0, .9], |
| + }, { |
| + duration: 500, |
| + fill: 'forwards' |
| + }); |
| + } |
| + }.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; |
| + }, |
| }); |