| 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() { |
| 6 var lazyLoadPromise = null; |
| 7 function ensureLazyLoaded() { |
| 8 if (!lazyLoadPromise) { |
| 9 lazyLoadPromise = new Promise(function(resolve, reject) { |
| 10 Polymer.Base.importHref( |
| 11 'chrome://history/lazy_load.html', resolve, reject, true); |
| 12 }); |
| 13 } |
| 14 return lazyLoadPromise; |
| 15 } |
| 16 |
| 17 return { |
| 18 ensureLazyLoaded: ensureLazyLoaded, |
| 19 }; |
| 20 }); |
| 21 |
| 5 Polymer({ | 22 Polymer({ |
| 6 is: 'history-app', | 23 is: 'history-app', |
| 7 | 24 |
| 8 behaviors: [Polymer.IronScrollTargetBehavior], | 25 behaviors: [Polymer.IronScrollTargetBehavior], |
| 9 | 26 |
| 10 properties: { | 27 properties: { |
| 11 // Used to display notices for profile sign-in status. | 28 // Used to display notices for profile sign-in status. |
| 12 showSidebarFooter: Boolean, | 29 showSidebarFooter: Boolean, |
| 13 | 30 |
| 14 hasSyncedResults: Boolean, | 31 hasSyncedResults: Boolean, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 chrome.send( | 136 chrome.send( |
| 120 'metricsHandler:recordTime', | 137 'metricsHandler:recordTime', |
| 121 ['History.ResultsRenderedTime', window.performance.now()]); | 138 ['History.ResultsRenderedTime', window.performance.now()]); |
| 122 }); | 139 }); |
| 123 | 140 |
| 124 // Focus the search field on load. Done here to ensure the history page | 141 // Focus the search field on load. Done here to ensure the history page |
| 125 // is rendered before we try to take focus. | 142 // is rendered before we try to take focus. |
| 126 if (!this.hasDrawer_) { | 143 if (!this.hasDrawer_) { |
| 127 this.focusToolbarSearchField(); | 144 this.focusToolbarSearchField(); |
| 128 } | 145 } |
| 146 |
| 147 // Lazily load the remainder of the UI. |
| 148 md_history.ensureLazyLoaded(); |
| 129 }, | 149 }, |
| 130 | 150 |
| 131 /** Overridden from IronScrollTargetBehavior */ | 151 /** Overridden from IronScrollTargetBehavior */ |
| 132 _scrollHandler: function() { | 152 _scrollHandler: function() { |
| 133 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0; | 153 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0; |
| 134 }, | 154 }, |
| 135 | 155 |
| 136 /** @private */ | 156 /** @private */ |
| 137 onMenuTap_: function() { | 157 onMenuTap_: function() { |
| 138 var drawer = this.$$('#drawer'); | 158 var drawer = this.$$('#drawer'); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 break; | 392 break; |
| 373 } | 393 } |
| 374 break; | 394 break; |
| 375 } | 395 } |
| 376 | 396 |
| 377 md_history.BrowserService.getInstance().recordHistogram( | 397 md_history.BrowserService.getInstance().recordHistogram( |
| 378 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END | 398 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END |
| 379 ); | 399 ); |
| 380 }, | 400 }, |
| 381 }); | 401 }); |
| OLD | NEW |