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 behaviors: [Polymer.IronA11yKeysBehavior], |
| 9 |
8 properties: { | 10 properties: { |
9 selectedPage: {type: String, notify: true}, | 11 selectedPage: {type: String, notify: true}, |
10 | 12 |
11 route: Object, | 13 route: Object, |
12 | 14 |
13 showFooter: Boolean, | 15 showFooter: Boolean, |
14 | 16 |
15 // If true, the sidebar is contained within an app-drawer. | 17 // If true, the sidebar is contained within an app-drawer. |
16 drawer: {type: Boolean, reflectToAttribute: true}, | 18 drawer: {type: Boolean, reflectToAttribute: true}, |
17 }, | 19 }, |
18 | 20 |
| 21 keyBindings: { |
| 22 'space:keydown': 'onSpacePressed_', |
| 23 }, |
| 24 |
| 25 /** |
| 26 * @param {CustomEvent} e |
| 27 * @private |
| 28 */ |
| 29 onSpacePressed_: function(e) { |
| 30 e.detail.keyboardEvent.path[0].click(); |
| 31 }, |
| 32 |
19 /** | 33 /** |
20 * @private | 34 * @private |
21 */ | 35 */ |
22 onSelectorActivate_: function() { this.fire('history-close-drawer'); }, | 36 onSelectorActivate_: function() { this.fire('history-close-drawer'); }, |
23 | 37 |
24 /** | 38 /** |
25 * Relocates the user to the clear browsing data section of the settings page. | 39 * Relocates the user to the clear browsing data section of the settings page. |
26 * @param {Event} e | 40 * @param {Event} e |
27 * @private | 41 * @private |
28 */ | 42 */ |
29 onClearBrowsingDataTap_: function(e) { | 43 onClearBrowsingDataTap_: function(e) { |
30 var browserService = md_history.BrowserService.getInstance(); | 44 var browserService = md_history.BrowserService.getInstance(); |
31 browserService.recordAction('InitClearBrowsingData'); | 45 browserService.recordAction('InitClearBrowsingData'); |
32 browserService.openClearBrowsingData(); | 46 browserService.openClearBrowsingData(); |
33 e.preventDefault(); | 47 e.preventDefault(); |
34 }, | 48 }, |
35 | 49 |
36 /** | 50 /** |
37 * @param {Object} route | 51 * @param {Object} route |
38 * @private | 52 * @private |
39 */ | 53 */ |
40 getQueryString_: function(route) { return window.location.search; } | 54 getQueryString_: function(route) { return window.location.search; } |
41 }); | 55 }); |
OLD | NEW |