| 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 // Histogram buckets for UMA tracking of menu usage. | |
| 6 /** @const */ var MENU_HISTOGRAM = { | |
| 7 HISTORY: 0, | |
| 8 SYNCED_TABS: 1, | |
| 9 END: 2, // Should always be last. | |
| 10 }; | |
| 11 | |
| 12 Polymer({ | 5 Polymer({ |
| 13 is: 'history-side-bar', | 6 is: 'history-side-bar', |
| 14 | 7 |
| 15 properties: { | 8 properties: { |
| 16 selectedPage: | 9 selectedPage: |
| 17 {type: String, notify: true, observer: 'selectedPageChanged_'}, | 10 {type: String, notify: true}, |
| 18 | 11 |
| 19 route: Object, | 12 route: Object, |
| 20 | 13 |
| 21 showFooter: Boolean, | 14 showFooter: Boolean, |
| 22 | 15 |
| 23 // If true, the sidebar is contained within an app-drawer. | 16 // If true, the sidebar is contained within an app-drawer. |
| 24 drawer: {type: Boolean, reflectToAttribute: true}, | 17 drawer: {type: Boolean, reflectToAttribute: true}, |
| 25 }, | 18 }, |
| 26 | 19 |
| 27 /** | 20 /** |
| 28 * @param {Event} e | 21 * @param {Event} e |
| 29 * @private | 22 * @private |
| 30 */ | 23 */ |
| 31 onSelectorActivate_: function(e) { | 24 onSelectorActivate_: function(e) { |
| 32 this.fire('history-close-drawer'); | 25 this.fire('history-close-drawer'); |
| 33 }, | 26 }, |
| 34 | 27 |
| 35 selectedPageChanged_: function(value, oldValue) { | |
| 36 if (!this.$.menu.selectedItem) | |
| 37 return; | |
| 38 | |
| 39 var histogramValue = MENU_HISTOGRAM.END; | |
| 40 switch(this.$.menu.selectedItem.getAttribute('path')) { | |
| 41 case 'history': | |
| 42 histogramValue = MENU_HISTOGRAM.HISTORY; | |
| 43 break; | |
| 44 case 'syncedTabs': | |
| 45 histogramValue = MENU_HISTOGRAM.SYNCED_TABS; | |
| 46 break; | |
| 47 } | |
| 48 md_history.BrowserService.getInstance().recordHistogram( | |
| 49 ['History.SidebarMenuSelected', histogramValue, MENU_HISTOGRAM.END]); | |
| 50 }, | |
| 51 | |
| 52 /** | 28 /** |
| 53 * Relocates the user to the clear browsing data section of the settings page. | 29 * Relocates the user to the clear browsing data section of the settings page. |
| 54 * @param {Event} e | 30 * @param {Event} e |
| 55 * @private | 31 * @private |
| 56 */ | 32 */ |
| 57 onClearBrowsingDataTap_: function(e) { | 33 onClearBrowsingDataTap_: function(e) { |
| 58 md_history.BrowserService.getInstance().recordAction( | 34 md_history.BrowserService.getInstance().recordAction( |
| 59 ['HistoryPage_InitClearBrowsingData']); | 35 ['HistoryPage_InitClearBrowsingData']); |
| 60 md_history.BrowserService.getInstance().openClearBrowsingData(); | 36 md_history.BrowserService.getInstance().openClearBrowsingData(); |
| 61 e.preventDefault(); | 37 e.preventDefault(); |
| 62 }, | 38 }, |
| 63 | 39 |
| 64 /** | 40 /** |
| 65 * @param {Object} route | 41 * @param {Object} route |
| 66 * @private | 42 * @private |
| 67 */ | 43 */ |
| 68 getQueryString_: function(route) { return window.location.search; } | 44 getQueryString_: function(route) { return window.location.search; } |
| 69 }); | 45 }); |
| OLD | NEW |