| 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..15466dcadeb8c60353802d56f12f934a4bdadb1a 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,12 @@ Polymer({
|
| value: false
|
| },
|
|
|
| + // Whether to show menu promo tooltip.
|
| + showMenuPromo: {
|
| + type: Boolean,
|
| + value: false,
|
| + },
|
| +
|
| /** @private */
|
| narrow_: {
|
| type: Boolean,
|
| @@ -41,13 +51,42 @@ Polymer({
|
| },
|
| },
|
|
|
| + observers: [
|
| + 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)',
|
| + ],
|
| +
|
| /** @return {!CrToolbarSearchFieldElement} */
|
| getSearchField: function() {
|
| return this.$.search;
|
| },
|
|
|
| /** @private */
|
| - onMenuTap_: function(e) {
|
| + onMenuTap_: function() {
|
| this.fire('cr-menu-tap');
|
| - }
|
| + this.onMenuPromoCloseTap_();
|
| + },
|
| +
|
| + /** @private */
|
| + onMenuPromoCloseTap_: function() {
|
| + this.showMenuPromo = false;
|
| + },
|
| +
|
| + /** @private */
|
| + possiblyShowMenuPromo_: function() {
|
| + Polymer.RenderStatus.afterNextRender(this, function() {
|
| + if (this.showMenu && this.showMenuPromo && !this.showingSearch_) {
|
| + this.$$('paper-tooltip').show();
|
| + 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;
|
| + },
|
| });
|
|
|