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