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

Side by Side 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: go full vanilla 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 11
12 // Prompt text to display in the search field. 12 // Prompt text to display in the search field.
13 searchPrompt: String, 13 searchPrompt: String,
14 14
15 // Tooltip to display on the clear search button. 15 // Tooltip to display on the clear search button.
16 clearLabel: String, 16 clearLabel: String,
17 17
18 // Tooltip to display on the menu button. 18 // Tooltip to display on the menu button.
19 menuLabel: String, 19 menuLabel: String,
20 20
21 // Promotional toolstip string, shown in narrow mode if showMenuPromo is
22 // true.
23 menuPromo: String,
24
21 // Value is proxied through to cr-toolbar-search-field. When true, 25 // Value is proxied through to cr-toolbar-search-field. When true,
22 // the search field will show a processing spinner. 26 // the search field will show a processing spinner.
23 spinnerActive: Boolean, 27 spinnerActive: Boolean,
24 28
25 // 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.
26 showMenu: { 30 showMenu: {
27 type: Boolean, 31 type: Boolean,
28 value: false 32 value: false
29 }, 33 },
30 34
35 // Whether to show menu promo tooltip.
36 showMenuPromo: {
37 type: Boolean,
38 value: false,
39 },
40
41 closeMenuPromo: String,
42
31 /** @private */ 43 /** @private */
32 narrow_: { 44 narrow_: {
33 type: Boolean, 45 type: Boolean,
34 reflectToAttribute: true 46 reflectToAttribute: true
35 }, 47 },
36 48
37 /** @private */ 49 /** @private */
38 showingSearch_: { 50 showingSearch_: {
39 type: Boolean, 51 type: Boolean,
40 reflectToAttribute: true, 52 reflectToAttribute: true,
41 }, 53 },
42 }, 54 },
43 55
56 observers: [
57 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)',
58 ],
59
44 /** @return {!CrToolbarSearchFieldElement} */ 60 /** @return {!CrToolbarSearchFieldElement} */
45 getSearchField: function() { 61 getSearchField: function() {
46 return this.$.search; 62 return this.$.search;
47 }, 63 },
48 64
49 /** @private */ 65 /** @private */
50 onMenuTap_: function(e) { 66 onClosePromoTap_: function() {
67 this.showMenuPromo = false;
68 },
69
70 /** @private */
71 onMenuTap_: function() {
51 this.fire('cr-menu-tap'); 72 this.fire('cr-menu-tap');
52 } 73 this.onClosePromoTap_();
74 },
75
76 /** @private */
77 possiblyShowMenuPromo_: function() {
78 Polymer.RenderStatus.afterNextRender(this, function() {
79 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.
80 this.$$('#menuPromo').animate({
81 opacity: [0, .9],
82 }, {
83 duration: 500,
84 fill: 'forwards'
85 });
86 }
87 }.bind(this));
88 },
89
90 /**
91 * @param {string} title
92 * @param {boolean} showMenuPromo
93 * @return {string} The title if the menu promo isn't showing, else "".
94 */
95 titleIfNotShowMenuPromo_: function(title, showMenuPromo) {
96 return showMenuPromo ? '' : title;
97 },
53 }); 98 });
OLDNEW
« 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