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', |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 // For routes from URL entry, we need to set selected. | 66 // For routes from URL entry, we need to set selected. |
| 67 this.$.basicMenu.selected = newRoute.path; | 67 this.$.basicMenu.selected = newRoute.path; |
| 68 } | 68 } |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @param {!Event} event | 72 * @param {!Event} event |
| 73 * @private | 73 * @private |
| 74 */ | 74 */ |
| 75 openPage_: function(event) { | 75 openPage_: function(event) { |
| 76 var route = settings.getRouteForPath(event.currentTarget.dataset.path); | 76 event.preventDefault(); |
| 77 var path = event.currentTarget.href.substr( | |
|
Dan Beam
2017/02/06 17:28:12
btw, there's a URL class
new URL(event.currentTar
hcarmona
2017/02/10 19:27:34
Sweet! Using URL.
| |
| 78 event.currentTarget.baseURI.length - 1); | |
|
dschuyler
2017/02/02 20:46:53
My guess is that line 77 is cutting off any query
hcarmona
2017/02/10 19:27:34
Changed to use URL
| |
| 79 var route = settings.getRouteForPath(path); | |
| 77 assert(route, 'settings-menu has an an entry with an invalid path'); | 80 assert(route, 'settings-menu has an an entry with an invalid path'); |
| 78 settings.navigateTo( | 81 settings.navigateTo( |
| 79 route, /* dynamicParams */ null, /* removeSearch */ true); | 82 route, /* dynamicParams */ null, /* removeSearch */ true); |
| 80 }, | 83 }, |
| 81 | 84 |
| 82 /** | 85 /** |
| 83 * @param {boolean} opened Whether the menu is expanded. | 86 * @param {boolean} opened Whether the menu is expanded. |
| 84 * @return {string} Which icon to use. | 87 * @return {string} Which icon to use. |
| 85 * @private | 88 * @private |
| 86 * */ | 89 * */ |
| 87 arrowState_: function(opened) { | 90 arrowState_: function(opened) { |
| 88 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; | 91 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 89 }, | 92 }, |
| 90 }); | 93 }); |
| OLD | NEW |