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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 chrome.send( | 134 chrome.send( |
118 'metricsHandler:recordTime', | 135 'metricsHandler:recordTime', |
119 ['History.ResultsRenderedTime', window.performance.now()]); | 136 ['History.ResultsRenderedTime', window.performance.now()]); |
120 }); | 137 }); |
121 | 138 |
122 // Focus the search field on load. Done here to ensure the history page | 139 // Focus the search field on load. Done here to ensure the history page |
123 // is rendered before we try to take focus. | 140 // is rendered before we try to take focus. |
124 if (!this.hasDrawer_) { | 141 if (!this.hasDrawer_) { |
125 this.focusToolbarSearchField(); | 142 this.focusToolbarSearchField(); |
126 } | 143 } |
| 144 |
| 145 // Lazily load the remainder of the UI. |
| 146 md_history.ensureLazyLoaded(); |
127 }, | 147 }, |
128 | 148 |
129 /** Overridden from IronScrollTargetBehavior */ | 149 /** Overridden from IronScrollTargetBehavior */ |
130 _scrollHandler: function() { | 150 _scrollHandler: function() { |
131 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0; | 151 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0; |
132 }, | 152 }, |
133 | 153 |
134 /** @private */ | 154 /** @private */ |
135 onMenuTap_: function() { | 155 onMenuTap_: function() { |
136 var drawer = this.$$('#drawer'); | 156 var drawer = this.$$('#drawer'); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 break; | 390 break; |
371 } | 391 } |
372 break; | 392 break; |
373 } | 393 } |
374 | 394 |
375 md_history.BrowserService.getInstance().recordHistogram( | 395 md_history.BrowserService.getInstance().recordHistogram( |
376 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END | 396 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END |
377 ); | 397 ); |
378 }, | 398 }, |
379 }); | 399 }); |
OLD | NEW |