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], | |
| 13 | |
| 12 properties: { | 14 properties: { |
| 13 /** @private */ | 15 /** @private */ |
| 14 advancedOpened_: Boolean, | 16 aboutSelected_: Boolean, |
|
Dan Beam
2016/10/14 00:09:09
this is still referenced from the HTML, but no lon
| |
| 15 | 17 |
| 16 /** | 18 /** |
| 17 * Dictionary defining page visibility. | 19 * Dictionary defining page visibility. |
| 18 * @type {!GuestModePageVisibility} | 20 * @type {!GuestModePageVisibility} |
| 19 */ | 21 */ |
| 20 pageVisibility: { | 22 pageVisibility: { |
| 21 type: Object, | 23 type: Object, |
| 22 }, | 24 }, |
| 23 }, | 25 }, |
| 24 | 26 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 | 38 |
| 37 this.$.advancedPage.addEventListener('paper-submenu-close', function() { | 39 this.$.advancedPage.addEventListener('paper-submenu-close', function() { |
| 38 this.fire('toggle-advanced-page', false); | 40 this.fire('toggle-advanced-page', false); |
| 39 }.bind(this)); | 41 }.bind(this)); |
| 40 | 42 |
| 41 this.fire('toggle-advanced-page', | 43 this.fire('toggle-advanced-page', |
| 42 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); | 44 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); |
| 43 }, | 45 }, |
| 44 | 46 |
| 45 /** | 47 /** |
| 48 * @param {!settings.Route} newRoute | |
| 49 */ | |
| 50 currentRouteChanged: function(newRoute) { | |
| 51 // Make the three menus mutually exclusive. | |
| 52 if (settings.Route.ABOUT.contains(newRoute)) { | |
| 53 this.aboutSelected_ = true; | |
| 54 this.$.advancedMenu.selected = null; | |
| 55 this.$.basicMenu.selected = null; | |
| 56 } else if (settings.Route.ADVANCED.contains(newRoute)) { | |
| 57 this.aboutSelected_ = false; | |
| 58 // For routes from URL entry, we need to set selected. | |
| 59 this.$.advancedMenu.selected = newRoute.path; | |
| 60 this.$.basicMenu.selected = null; | |
| 61 } else if (settings.Route.BASIC.contains(newRoute)) { | |
| 62 this.aboutSelected_ = false; | |
| 63 this.$.advancedMenu.selected = null; | |
| 64 // For routes from URL entry, we need to set selected. | |
| 65 this.$.basicMenu.selected = newRoute.path; | |
| 66 } | |
| 67 }, | |
| 68 | |
| 69 /** | |
| 46 * @param {!Event} event | 70 * @param {!Event} event |
| 47 * @private | 71 * @private |
| 48 */ | 72 */ |
| 49 ripple_: function(event) { | 73 ripple_: function(event) { |
| 50 var ripple = document.createElement('paper-ripple'); | 74 var ripple = document.createElement('paper-ripple'); |
| 51 ripple.addEventListener('transitionend', function() { | 75 ripple.addEventListener('transitionend', function() { |
| 52 ripple.remove(); | 76 ripple.remove(); |
| 53 }); | 77 }); |
| 54 event.currentTarget.appendChild(ripple); | 78 event.currentTarget.appendChild(ripple); |
| 55 ripple.downAction(); | 79 ripple.downAction(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 68 | 92 |
| 69 /** | 93 /** |
| 70 * @param {boolean} opened Whether the menu is expanded. | 94 * @param {boolean} opened Whether the menu is expanded. |
| 71 * @return {string} Which icon to use. | 95 * @return {string} Which icon to use. |
| 72 * @private | 96 * @private |
| 73 * */ | 97 * */ |
| 74 arrowState_: function(opened) { | 98 arrowState_: function(opened) { |
| 75 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 99 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 76 }, | 100 }, |
| 77 }); | 101 }); |
| OLD | NEW |