| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Polymer({ | 5 Polymer({ |
| 6 is: 'history-side-bar', | 6 is: 'history-side-bar', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 selectedPage: { | 9 selectedPage: { |
| 10 type: String, | 10 type: String, |
| 11 notify: true | 11 notify: true |
| 12 }, | 12 }, |
| 13 | 13 |
| 14 route: Object, | 14 route: Object, |
| 15 | 15 |
| 16 showFooter: Boolean, | 16 showFooter: Boolean, |
| 17 | 17 |
| 18 // If true, the sidebar is contained within an app-drawer. | 18 // If true, the sidebar is contained within an app-drawer. |
| 19 drawer: { | 19 drawer: { |
| 20 type: Boolean, | 20 type: Boolean, |
| 21 reflectToAttribute: true | 21 reflectToAttribute: true |
| 22 }, | 22 }, |
| 23 }, | 23 }, |
| 24 | 24 |
| 25 focusCurrentPage: function() { | |
| 26 // The desired behavior is for the app-drawer to focus the currently | |
| 27 // selected menu item on opening. However, it will always focus the first | |
| 28 // focusable child. Therefore, we set tabindex=0 on the app-drawer so that | |
| 29 // it will focus itself and then immediately delegate focus to the selected | |
| 30 // item in this listener. | |
| 31 this.$.menu.selectedItem.focus(); | |
| 32 }, | |
| 33 | |
| 34 /** @private */ | 25 /** @private */ |
| 35 onSelectorActivate_: function() { | 26 onSelectorActivate_: function() { |
| 36 this.fire('history-close-drawer'); | 27 this.fire('history-close-drawer'); |
| 37 }, | 28 }, |
| 38 | 29 |
| 39 /** | 30 /** |
| 40 * Relocates the user to the clear browsing data section of the settings page. | 31 * Relocates the user to the clear browsing data section of the settings page. |
| 41 * @param {Event} e | 32 * @param {Event} e |
| 42 * @private | 33 * @private |
| 43 */ | 34 */ |
| 44 onClearBrowsingDataTap_: function(e) { | 35 onClearBrowsingDataTap_: function(e) { |
| 45 md_history.BrowserService.getInstance().openClearBrowsingData(); | 36 md_history.BrowserService.getInstance().openClearBrowsingData(); |
| 46 e.preventDefault(); | 37 e.preventDefault(); |
| 47 }, | 38 }, |
| 48 | 39 |
| 49 /** | 40 /** |
| 50 * @param {Object} route | 41 * @param {Object} route |
| 51 * @private | 42 * @private |
| 52 */ | 43 */ |
| 53 getQueryString_: function(route) { | 44 getQueryString_: function(route) { |
| 54 return window.location.search; | 45 return window.location.search; |
| 55 } | 46 } |
| 56 }); | 47 }); |
| OLD | NEW |