| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 Polymer({ | 5 Polymer({ |
| 6 is: 'cr-toolbar', | 6 is: 'cr-toolbar', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // Name to display in the toolbar, in titlecase. | 9 // Name to display in the toolbar, in titlecase. |
| 10 pageName: String, | 10 pageName: String, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 type: Boolean, | 45 type: Boolean, |
| 46 reflectToAttribute: true, | 46 reflectToAttribute: true, |
| 47 }, | 47 }, |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 observers: [ | 50 observers: [ |
| 51 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)', | 51 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)', |
| 52 ], | 52 ], |
| 53 | 53 |
| 54 /** @return {!CrToolbarSearchFieldElement} */ | 54 /** @return {!CrToolbarSearchFieldElement} */ |
| 55 getSearchField: function() { return this.$.search; }, | 55 getSearchField: function() { |
| 56 return this.$.search; |
| 57 }, |
| 56 | 58 |
| 57 /** @private */ | 59 /** @private */ |
| 58 onClosePromoTap_: function() { this.fire('cr-toolbar-menu-promo-close'); }, | 60 onClosePromoTap_: function() { |
| 61 this.fire('cr-toolbar-menu-promo-close'); |
| 62 }, |
| 59 | 63 |
| 60 /** @private */ | 64 /** @private */ |
| 61 onMenuTap_: function() { this.fire('cr-toolbar-menu-tap'); }, | 65 onMenuTap_: function() { |
| 66 this.fire('cr-toolbar-menu-tap'); |
| 67 }, |
| 62 | 68 |
| 63 /** @private */ | 69 /** @private */ |
| 64 possiblyShowMenuPromo_: function() { | 70 possiblyShowMenuPromo_: function() { |
| 65 Polymer.RenderStatus.afterNextRender(this, function() { | 71 Polymer.RenderStatus.afterNextRender(this, function() { |
| 66 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { | 72 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { |
| 67 this.$$('#menuPromo') | 73 this.$$('#menuPromo') |
| 68 .animate( | 74 .animate( |
| 69 { | 75 { |
| 70 opacity: [0, .9], | 76 opacity: [0, .9], |
| 71 }, | 77 }, |
| 72 /** @type {!KeyframeEffectOptions} */ ( | 78 /** @type {!KeyframeEffectOptions} */ ( |
| 73 {duration: 500, fill: 'forwards'})); | 79 {duration: 500, fill: 'forwards'})); |
| 74 this.fire('cr-toolbar-menu-promo-shown'); | 80 this.fire('cr-toolbar-menu-promo-shown'); |
| 75 } | 81 } |
| 76 }.bind(this)); | 82 }.bind(this)); |
| 77 }, | 83 }, |
| 78 | 84 |
| 79 /** | 85 /** |
| 80 * @param {string} title | 86 * @param {string} title |
| 81 * @param {boolean} showMenuPromo | 87 * @param {boolean} showMenuPromo |
| 82 * @return {string} The title if the menu promo isn't showing, else "". | 88 * @return {string} The title if the menu promo isn't showing, else "". |
| 83 */ | 89 */ |
| 84 titleIfNotShowMenuPromo_: function(title, showMenuPromo) { | 90 titleIfNotShowMenuPromo_: function(title, showMenuPromo) { |
| 85 return showMenuPromo ? '' : title; | 91 return showMenuPromo ? '' : title; |
| 86 }, | 92 }, |
| 87 }); | 93 }); |
| OLD | NEW |