Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. | 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-menu', | 10 is: 'settings-menu', |
| 11 | 11 |
| 12 behaviors: [settings.RouteObserverBehavior], | 12 behaviors: [settings.RouteObserverBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 advancedOpened: { | |
| 16 type: Boolean, | |
| 17 notify: true, | |
| 18 }, | |
| 19 | |
| 15 /** @private */ | 20 /** @private */ |
| 16 aboutSelected_: Boolean, | 21 aboutSelected_: Boolean, |
| 17 | 22 |
| 18 /** | 23 /** |
| 19 * Dictionary defining page visibility. | 24 * Dictionary defining page visibility. |
| 20 * @type {!GuestModePageVisibility} | 25 * @type {!GuestModePageVisibility} |
| 21 */ | 26 */ |
| 22 pageVisibility: { | 27 pageVisibility: { |
| 23 type: Object, | 28 type: Object, |
| 24 }, | 29 }, |
| 25 }, | 30 }, |
| 26 | 31 |
| 27 attached: function() { | |
|
dpapad
2016/10/17 19:11:43
Nice!!
Dan Beam
2016/10/17 20:52:17
Acknowledged.
| |
| 28 document.addEventListener('toggle-advanced-page', function(e) { | |
| 29 if (e.detail) | |
| 30 this.$.advancedPage.open(); | |
| 31 else | |
| 32 this.$.advancedPage.close(); | |
| 33 }.bind(this)); | |
| 34 | |
| 35 this.$.advancedPage.addEventListener('paper-submenu-open', function() { | |
| 36 this.fire('toggle-advanced-page', true); | |
| 37 }.bind(this)); | |
| 38 | |
| 39 this.$.advancedPage.addEventListener('paper-submenu-close', function() { | |
| 40 this.fire('toggle-advanced-page', false); | |
| 41 }.bind(this)); | |
| 42 | |
| 43 this.fire('toggle-advanced-page', | |
| 44 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); | |
| 45 }, | |
| 46 | |
| 47 /** | 32 /** |
| 48 * @param {!settings.Route} newRoute | 33 * @param {!settings.Route} newRoute |
| 49 */ | 34 */ |
| 50 currentRouteChanged: function(newRoute) { | 35 currentRouteChanged: function(newRoute) { |
| 51 // Make the three menus mutually exclusive. | 36 // Make the three menus mutually exclusive. |
| 52 if (settings.Route.ABOUT.contains(newRoute)) { | 37 if (settings.Route.ABOUT.contains(newRoute)) { |
| 53 this.aboutSelected_ = true; | 38 this.aboutSelected_ = true; |
| 54 this.$.advancedMenu.selected = null; | 39 this.$.advancedMenu.selected = null; |
| 55 this.$.basicMenu.selected = null; | 40 this.$.basicMenu.selected = null; |
| 56 } else if (settings.Route.ADVANCED.contains(newRoute)) { | 41 } else if (settings.Route.ADVANCED.contains(newRoute)) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 78 | 63 |
| 79 /** | 64 /** |
| 80 * @param {boolean} opened Whether the menu is expanded. | 65 * @param {boolean} opened Whether the menu is expanded. |
| 81 * @return {string} Which icon to use. | 66 * @return {string} Which icon to use. |
| 82 * @private | 67 * @private |
| 83 * */ | 68 * */ |
| 84 arrowState_: function(opened) { | 69 arrowState_: function(opened) { |
| 85 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 70 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 86 }, | 71 }, |
| 87 }); | 72 }); |
| OLD | NEW |