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 */ |
| 16 aboutSelected_: Boolean, | |
| 17 | |
| 18 /** @private */ | |
| 14 advancedOpened_: Boolean, | 19 advancedOpened_: Boolean, |
|
tommycli
2016/08/22 23:23:00
I think you can axe this property declaration, sin
dschuyler
2016/08/22 23:35:09
Done.
| |
| 15 | 20 |
| 16 /** | 21 /** |
| 17 * Dictionary defining page visibility. | 22 * Dictionary defining page visibility. |
| 18 * @type {!GuestModePageVisibility} | 23 * @type {!GuestModePageVisibility} |
| 19 */ | 24 */ |
| 20 pageVisibility: { | 25 pageVisibility: { |
| 21 type: Object, | 26 type: Object, |
| 22 }, | 27 }, |
| 23 }, | 28 }, |
| 24 | 29 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 | 41 |
| 37 this.$.advancedPage.addEventListener('paper-submenu-close', function() { | 42 this.$.advancedPage.addEventListener('paper-submenu-close', function() { |
| 38 this.fire('toggle-advanced-page', false); | 43 this.fire('toggle-advanced-page', false); |
| 39 }.bind(this)); | 44 }.bind(this)); |
| 40 | 45 |
| 41 this.fire('toggle-advanced-page', | 46 this.fire('toggle-advanced-page', |
| 42 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); | 47 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); |
| 43 }, | 48 }, |
| 44 | 49 |
| 45 /** | 50 /** |
| 51 * Handle setting selected menu item from URL routes as well as menu | |
| 52 * selections. | |
|
tommycli
2016/08/22 23:23:00
nit: clarify comment to something like:
Update me
dschuyler
2016/08/22 23:35:09
I wanted to point out that some of the code
is imp
tommycli
2016/08/22 23:36:58
Thanks. New comments helpful. This is a subtle pie
| |
| 53 * @param {!settings.Route} newRoute | |
| 54 */ | |
| 55 currentRouteChanged: function(newRoute) { | |
| 56 // Make the three menus mutually exclusive. | |
| 57 if (settings.Route.ABOUT.contains(newRoute)) { | |
| 58 this.aboutSelected_ = true; | |
| 59 this.$.advancedMenu.selected = null; | |
| 60 this.$.basicMenu.selected = null; | |
| 61 } else if (settings.Route.ADVANCED.contains(newRoute)) { | |
| 62 this.aboutSelected_ = false; | |
| 63 this.$.advancedMenu.selected = newRoute.path; | |
| 64 this.$.basicMenu.selected = null; | |
| 65 } else if (settings.Route.BASIC.contains(newRoute)) { | |
| 66 this.aboutSelected_ = false; | |
| 67 this.$.advancedMenu.selected = null; | |
| 68 this.$.basicMenu.selected = newRoute.path; | |
| 69 } | |
| 70 }, | |
| 71 | |
| 72 /** | |
| 46 * @param {!Event} event | 73 * @param {!Event} event |
| 47 * @private | 74 * @private |
| 48 */ | 75 */ |
| 49 ripple_: function(event) { | 76 ripple_: function(event) { |
| 50 var ripple = document.createElement('paper-ripple'); | 77 var ripple = document.createElement('paper-ripple'); |
| 51 ripple.addEventListener('transitionend', function() { | 78 ripple.addEventListener('transitionend', function() { |
| 52 ripple.remove(); | 79 ripple.remove(); |
| 53 }); | 80 }); |
| 54 event.currentTarget.appendChild(ripple); | 81 event.currentTarget.appendChild(ripple); |
| 55 ripple.downAction(); | 82 ripple.downAction(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 68 | 95 |
| 69 /** | 96 /** |
| 70 * @param {boolean} opened Whether the menu is expanded. | 97 * @param {boolean} opened Whether the menu is expanded. |
| 71 * @return {string} Which icon to use. | 98 * @return {string} Which icon to use. |
| 72 * @private | 99 * @private |
| 73 * */ | 100 * */ |
| 74 arrowState_: function(opened) { | 101 arrowState_: function(opened) { |
| 75 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 102 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 76 }, | 103 }, |
| 77 }); | 104 }); |
| OLD | NEW |