| 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], | 8 behaviors: [Polymer.IronA11yKeysBehavior], |
| 9 | 9 |
| 10 properties: { | 10 properties: { |
| 11 selectedPage: {type: String, notify: true}, | 11 selectedPage: { |
| 12 type: String, |
| 13 notify: true, |
| 14 }, |
| 15 |
| 16 // If true, the sidebar is contained within an app-drawer. |
| 17 drawer: { |
| 18 type: Boolean, |
| 19 reflectToAttribute: true, |
| 20 }, |
| 12 | 21 |
| 13 showFooter: Boolean, | 22 showFooter: Boolean, |
| 14 | |
| 15 // If true, the sidebar is contained within an app-drawer. | |
| 16 drawer: {type: Boolean, reflectToAttribute: true}, | |
| 17 }, | 23 }, |
| 18 | 24 |
| 19 keyBindings: { | 25 keyBindings: { |
| 20 'space:keydown': 'onSpacePressed_', | 26 'space:keydown': 'onSpacePressed_', |
| 21 }, | 27 }, |
| 22 | 28 |
| 23 /** | 29 /** |
| 24 * @param {CustomEvent} e | 30 * @param {CustomEvent} e |
| 25 * @private | 31 * @private |
| 26 */ | 32 */ |
| 27 onSpacePressed_: function(e) { | 33 onSpacePressed_: function(e) { e.detail.keyboardEvent.path[0].click(); }, |
| 28 e.detail.keyboardEvent.path[0].click(); | |
| 29 }, | |
| 30 | 34 |
| 31 /** | 35 /** |
| 32 * @private | 36 * @private |
| 33 */ | 37 */ |
| 34 onSelectorActivate_: function() { this.fire('history-close-drawer'); }, | 38 onSelectorActivate_: function() { this.fire('history-close-drawer'); }, |
| 35 | 39 |
| 36 /** | 40 /** |
| 37 * Relocates the user to the clear browsing data section of the settings page. | 41 * Relocates the user to the clear browsing data section of the settings page. |
| 38 * @param {Event} e | 42 * @param {Event} e |
| 39 * @private | 43 * @private |
| 40 */ | 44 */ |
| 41 onClearBrowsingDataTap_: function(e) { | 45 onClearBrowsingDataTap_: function(e) { |
| 42 var browserService = md_history.BrowserService.getInstance(); | 46 var browserService = md_history.BrowserService.getInstance(); |
| 43 browserService.recordAction('InitClearBrowsingData'); | 47 browserService.recordAction('InitClearBrowsingData'); |
| 44 browserService.openClearBrowsingData(); | 48 browserService.openClearBrowsingData(); |
| 45 /** @type {PaperRippleElement} */(this.$['cbd-ripple']).upAction(); | 49 /** @type {PaperRippleElement} */ (this.$['cbd-ripple']).upAction(); |
| 46 e.preventDefault(); | 50 e.preventDefault(); |
| 47 }, | 51 }, |
| 48 | 52 |
| 49 /** | 53 /** |
| 50 * Prevent clicks on sidebar items from navigating. These are only links for | 54 * Prevent clicks on sidebar items from navigating. These are only links for |
| 51 * accessibility purposes, taps are handled separately by <iron-selector>. | 55 * accessibility purposes, taps are handled separately by <iron-selector>. |
| 52 * @private | 56 * @private |
| 53 */ | 57 */ |
| 54 onItemClick_: function(e) { | 58 onItemClick_: function(e) { e.preventDefault(); }, |
| 55 e.preventDefault(); | |
| 56 }, | |
| 57 }); | 59 }); |
| OLD | NEW |