| 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 cr.define('md_history', function() { | 5 cr.define('md_history', function() { |
| 6 var lazyLoadPromise = null; | 6 var lazyLoadPromise = null; |
| 7 function ensureLazyLoaded() { | 7 function ensureLazyLoaded() { |
| 8 if (!lazyLoadPromise) { | 8 if (!lazyLoadPromise) { |
| 9 lazyLoadPromise = new Promise(function(resolve, reject) { | 9 lazyLoadPromise = new Promise(function(resolve, reject) { |
| 10 Polymer.Base.importHref( | 10 Polymer.Base.importHref( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }, | 81 }, |
| 82 | 82 |
| 83 listeners: { | 83 listeners: { |
| 84 'cr-toolbar-menu-promo-close': 'onCrToolbarMenuPromoClose_', | 84 'cr-toolbar-menu-promo-close': 'onCrToolbarMenuPromoClose_', |
| 85 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_', | 85 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_', |
| 86 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_', | 86 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_', |
| 87 'delete-selected': 'deleteSelected', | 87 'delete-selected': 'deleteSelected', |
| 88 'history-checkbox-select': 'checkboxSelected', | 88 'history-checkbox-select': 'checkboxSelected', |
| 89 'history-close-drawer': 'closeDrawer_', | 89 'history-close-drawer': 'closeDrawer_', |
| 90 'history-view-changed': 'historyViewChanged_', | 90 'history-view-changed': 'historyViewChanged_', |
| 91 'opened-changed': 'onOpenedChanged_', | |
| 92 'unselect-all': 'unselectAll', | 91 'unselect-all': 'unselectAll', |
| 93 }, | 92 }, |
| 94 | 93 |
| 95 /** @private {?function(!Event)} */ | 94 /** @private {?function(!Event)} */ |
| 96 boundOnCanExecute_: null, | 95 boundOnCanExecute_: null, |
| 97 | 96 |
| 98 /** @private {?function(!Event)} */ | 97 /** @private {?function(!Event)} */ |
| 99 boundOnCommand_: null, | 98 boundOnCommand_: null, |
| 100 | 99 |
| 101 /** @override */ | 100 /** @override */ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 /** @private */ | 150 /** @private */ |
| 152 onCrToolbarMenuPromoShown_: function() { | 151 onCrToolbarMenuPromoShown_: function() { |
| 153 md_history.BrowserService.getInstance().menuPromoShown(); | 152 md_history.BrowserService.getInstance().menuPromoShown(); |
| 154 }, | 153 }, |
| 155 | 154 |
| 156 /** @private */ | 155 /** @private */ |
| 157 onCrToolbarMenuTap_: function() { | 156 onCrToolbarMenuTap_: function() { |
| 158 var drawer = /** @type {!CrDrawerElement} */ (this.$.drawer.get()); | 157 var drawer = /** @type {!CrDrawerElement} */ (this.$.drawer.get()); |
| 159 drawer.align = document.documentElement.dir == 'ltr' ? 'left' : 'right'; | 158 drawer.align = document.documentElement.dir == 'ltr' ? 'left' : 'right'; |
| 160 drawer.toggle(); | 159 drawer.toggle(); |
| 160 this.showMenuPromo_ = false; |
| 161 }, | 161 }, |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * @param {!CustomEvent} e | |
| 165 * @private | |
| 166 */ | |
| 167 onOpenedChanged_: function(e) { | |
| 168 if (e.detail.value) | |
| 169 this.showMenuPromo_ = false; | |
| 170 }, | |
| 171 | |
| 172 /** | |
| 173 * Listens for history-item being selected or deselected (through checkbox) | 164 * Listens for history-item being selected or deselected (through checkbox) |
| 174 * and changes the view of the top toolbar. | 165 * and changes the view of the top toolbar. |
| 175 * @param {{detail: {countAddition: number}}} e | 166 * @param {{detail: {countAddition: number}}} e |
| 176 */ | 167 */ |
| 177 checkboxSelected: function(e) { | 168 checkboxSelected: function(e) { |
| 178 var toolbar = /** @type {HistoryToolbarElement} */ (this.$.toolbar); | 169 var toolbar = /** @type {HistoryToolbarElement} */ (this.$.toolbar); |
| 179 toolbar.count = /** @type {HistoryListElement} */ (this.$.history) | 170 toolbar.count = /** @type {HistoryListElement} */ (this.$.history) |
| 180 .getSelectedItemCount(); | 171 .getSelectedItemCount(); |
| 181 }, | 172 }, |
| 182 | 173 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 default: | 345 default: |
| 355 histogramValue = HistoryPageViewHistogram.HISTORY; | 346 histogramValue = HistoryPageViewHistogram.HISTORY; |
| 356 break; | 347 break; |
| 357 } | 348 } |
| 358 | 349 |
| 359 md_history.BrowserService.getInstance().recordHistogram( | 350 md_history.BrowserService.getInstance().recordHistogram( |
| 360 'History.HistoryPageView', histogramValue, | 351 'History.HistoryPageView', histogramValue, |
| 361 HistoryPageViewHistogram.END); | 352 HistoryPageViewHistogram.END); |
| 362 }, | 353 }, |
| 363 }); | 354 }); |
| OLD | NEW |