| 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 properties: { | 12 properties: { |
| 13 /** @private */ | 13 /** @private */ |
| 14 advancedOpened_: Boolean, | 14 advancedOpened_: Boolean, |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * The current active route. | |
| 18 * @type {!settings.Route} | |
| 19 */ | |
| 20 currentRoute: { | |
| 21 type: Object, | |
| 22 notify: true, | |
| 23 }, | |
| 24 | |
| 25 /** | |
| 26 * Dictionary defining page visibility. | 17 * Dictionary defining page visibility. |
| 27 * @type {!GuestModePageVisibility} | 18 * @type {!GuestModePageVisibility} |
| 28 */ | 19 */ |
| 29 pageVisibility: { | 20 pageVisibility: { |
| 30 type: Object, | 21 type: Object, |
| 31 }, | 22 }, |
| 32 }, | 23 }, |
| 33 | 24 |
| 34 attached: function() { | 25 attached: function() { |
| 35 document.addEventListener('toggle-advanced-page', function(e) { | 26 document.addEventListener('toggle-advanced-page', function(e) { |
| 36 if (e.detail) | 27 if (e.detail) |
| 37 this.$.advancedPage.open(); | 28 this.$.advancedPage.open(); |
| 38 else | 29 else |
| 39 this.$.advancedPage.close(); | 30 this.$.advancedPage.close(); |
| 40 }.bind(this)); | 31 }.bind(this)); |
| 41 | 32 |
| 42 this.$.advancedPage.addEventListener('paper-submenu-open', function() { | 33 this.$.advancedPage.addEventListener('paper-submenu-open', function() { |
| 43 this.fire('toggle-advanced-page', true); | 34 this.fire('toggle-advanced-page', true); |
| 44 }.bind(this)); | 35 }.bind(this)); |
| 45 | 36 |
| 46 this.$.advancedPage.addEventListener('paper-submenu-close', function() { | 37 this.$.advancedPage.addEventListener('paper-submenu-close', function() { |
| 47 this.fire('toggle-advanced-page', false); | 38 this.fire('toggle-advanced-page', false); |
| 48 }.bind(this)); | 39 }.bind(this)); |
| 49 | 40 |
| 50 this.fire('toggle-advanced-page', | 41 this.fire('toggle-advanced-page', |
| 51 settings.Route.ADVANCED.contains(this.currentRoute)); | 42 settings.Route.ADVANCED.contains(settings.getCurrentRoute())); |
| 52 }, | 43 }, |
| 53 | 44 |
| 54 /** | 45 /** |
| 55 * @param {!Node} target | 46 * @param {!Node} target |
| 56 * @private | 47 * @private |
| 57 */ | 48 */ |
| 58 ripple_: function(target) { | 49 ripple_: function(target) { |
| 59 var ripple = document.createElement('paper-ripple'); | 50 var ripple = document.createElement('paper-ripple'); |
| 60 ripple.addEventListener('transitionend', function() { | 51 ripple.addEventListener('transitionend', function() { |
| 61 ripple.remove(); | 52 ripple.remove(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 | 70 |
| 80 /** | 71 /** |
| 81 * @param {boolean} opened Whether the menu is expanded. | 72 * @param {boolean} opened Whether the menu is expanded. |
| 82 * @return {string} Which icon to use. | 73 * @return {string} Which icon to use. |
| 83 * @private | 74 * @private |
| 84 * */ | 75 * */ |
| 85 arrowState_: function(opened) { | 76 arrowState_: function(opened) { |
| 86 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 77 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 87 }, | 78 }, |
| 88 }); | 79 }); |
| OLD | NEW |