| 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', |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Dictionary defining page visibility. | 24 * Dictionary defining page visibility. |
| 25 * @type {!GuestModePageVisibility} | 25 * @type {!GuestModePageVisibility} |
| 26 */ | 26 */ |
| 27 pageVisibility: { | 27 pageVisibility: { |
| 28 type: Object, | 28 type: Object, |
| 29 }, | 29 }, |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 ready: function() { |
| 33 // When a <paper-submenu> is created with the [opened] attribute as true, |
| 34 // its _active member isn't correctly initialized. See this bug for more |
| 35 // info: https://github.com/PolymerElements/paper-menu/issues/88. This means |
| 36 // the first tap to close an opened Advanced section does nothing (because |
| 37 // it calls .open() on an opened menu instead of .close(). This is a fix for |
| 38 // that bug without changing that code through its public API. |
| 39 // |
| 40 // TODO(dbeam): we're currently deciding whether <paper-{,sub}menu> are |
| 41 // right for our needs (there have been minor a11y problems). If we decide |
| 42 // to keep <paper-{,sub}menu>, fix this bug with a local Chrome CL (ex: |
| 43 // https://codereview.chromium.org/2412343004) or a Polymer PR (ex: |
| 44 // https://github.com/PolymerElements/paper-menu/pull/107). |
| 45 if (this.advancedOpened) |
| 46 this.$.advancedPage.open(); |
| 47 }, |
| 48 |
| 32 /** | 49 /** |
| 33 * @param {!settings.Route} newRoute | 50 * @param {!settings.Route} newRoute |
| 34 */ | 51 */ |
| 35 currentRouteChanged: function(newRoute) { | 52 currentRouteChanged: function(newRoute) { |
| 36 // Make the three menus mutually exclusive. | 53 // Make the three menus mutually exclusive. |
| 37 if (settings.Route.ABOUT.contains(newRoute)) { | 54 if (settings.Route.ABOUT.contains(newRoute)) { |
| 38 this.aboutSelected_ = true; | 55 this.aboutSelected_ = true; |
| 39 this.$.advancedMenu.selected = null; | 56 this.$.advancedMenu.selected = null; |
| 40 this.$.basicMenu.selected = null; | 57 this.$.basicMenu.selected = null; |
| 41 } else if (settings.Route.ADVANCED.contains(newRoute)) { | 58 } else if (settings.Route.ADVANCED.contains(newRoute)) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 | 80 |
| 64 /** | 81 /** |
| 65 * @param {boolean} opened Whether the menu is expanded. | 82 * @param {boolean} opened Whether the menu is expanded. |
| 66 * @return {string} Which icon to use. | 83 * @return {string} Which icon to use. |
| 67 * @private | 84 * @private |
| 68 * */ | 85 * */ |
| 69 arrowState_: function(opened) { | 86 arrowState_: function(opened) { |
| 70 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 87 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 71 }, | 88 }, |
| 72 }); | 89 }); |
| OLD | NEW |