Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 // Controls whether the menu button is shown at the start of the menu. | 29 // Controls whether the menu button is shown at the start of the menu. |
| 30 showMenu: { | 30 showMenu: { |
| 31 type: Boolean, | 31 type: Boolean, |
| 32 value: false | 32 value: false |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 // Whether to show menu promo tooltip. | 35 // Whether to show menu promo tooltip. |
| 36 showMenuPromo: { | 36 showMenuPromo: { |
| 37 type: Boolean, | 37 type: Boolean, |
| 38 value: false, | 38 notify: true, |
|
calamity
2016/10/27 02:12:41
Is it necessary to remove the value: false here? C
| |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 closeMenuPromo: String, | 41 closeMenuPromo: String, |
| 42 | 42 |
| 43 /** @private */ | 43 /** @private */ |
| 44 narrow_: { | 44 narrow_: { |
| 45 type: Boolean, | 45 type: Boolean, |
| 46 reflectToAttribute: true | 46 reflectToAttribute: true |
| 47 }, | 47 }, |
| 48 | 48 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 /** @private */ | 65 /** @private */ |
| 66 onClosePromoTap_: function() { | 66 onClosePromoTap_: function() { |
| 67 this.showMenuPromo = false; | 67 this.showMenuPromo = false; |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** @private */ | 70 /** @private */ |
| 71 onMenuTap_: function() { | 71 onMenuTap_: function() { |
| 72 this.fire('cr-menu-tap'); | 72 this.fire('cr-menu-tap'); |
| 73 this.onClosePromoTap_(); | |
| 74 }, | 73 }, |
| 75 | 74 |
| 76 /** @private */ | 75 /** @private */ |
| 77 possiblyShowMenuPromo_: function() { | 76 possiblyShowMenuPromo_: function() { |
| 78 Polymer.RenderStatus.afterNextRender(this, function() { | 77 Polymer.RenderStatus.afterNextRender(this, function() { |
| 79 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { | 78 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { |
| 80 this.$$('#menuPromo').animate({ | 79 this.$$('#menuPromo').animate({ |
| 81 opacity: [0, .9], | 80 opacity: [0, .9], |
| 82 }, /** @type {!KeyframeEffectOptions} */({ | 81 }, /** @type {!KeyframeEffectOptions} */({ |
| 83 duration: 500, | 82 duration: 500, |
| 84 fill: 'forwards' | 83 fill: 'forwards' |
| 85 })); | 84 })); |
| 86 this.fire('cr-menu-promo-shown'); | 85 this.fire('cr-menu-promo-shown'); |
| 87 } | 86 } |
| 88 }.bind(this)); | 87 }.bind(this)); |
| 89 }, | 88 }, |
| 90 | 89 |
| 91 /** | 90 /** |
| 92 * @param {string} title | 91 * @param {string} title |
| 93 * @param {boolean} showMenuPromo | 92 * @param {boolean} showMenuPromo |
| 94 * @return {string} The title if the menu promo isn't showing, else "". | 93 * @return {string} The title if the menu promo isn't showing, else "". |
| 95 */ | 94 */ |
| 96 titleIfNotShowMenuPromo_: function(title, showMenuPromo) { | 95 titleIfNotShowMenuPromo_: function(title, showMenuPromo) { |
| 97 return showMenuPromo ? '' : title; | 96 return showMenuPromo ? '' : title; |
| 98 }, | 97 }, |
| 99 }); | 98 }); |
| OLD | NEW |