| 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( |
| 11 'chrome://history/lazy_load.html', resolve, reject, true); | 11 'chrome://history/lazy_load.html', resolve, reject, true); |
| 12 }); | 12 }); |
| 13 } | 13 } |
| 14 return lazyLoadPromise; | 14 return lazyLoadPromise; |
| 15 } | 15 } |
| 16 | 16 |
| 17 return { | 17 return { |
| 18 ensureLazyLoaded: ensureLazyLoaded, | 18 ensureLazyLoaded: ensureLazyLoaded, |
| 19 }; | 19 }; |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 Polymer({ | 22 Polymer({ |
| 23 is: 'history-app', | 23 is: 'history-app', |
| 24 | 24 |
| 25 behaviors: [Polymer.IronScrollTargetBehavior], | 25 behaviors: [ |
| 26 Polymer.IronScrollTargetBehavior, |
| 27 WebUIListenerBehavior, |
| 28 ], |
| 26 | 29 |
| 27 properties: { | 30 properties: { |
| 28 // Used to display notices for profile sign-in status. | 31 // Used to display notices for profile sign-in status. |
| 29 showSidebarFooter: Boolean, | 32 showSidebarFooter: Boolean, |
| 30 | 33 |
| 31 hasSyncedResults: Boolean, | 34 hasSyncedResults: Boolean, |
| 32 | 35 |
| 33 // The id of the currently selected page. | 36 // The id of the currently selected page. |
| 34 selectedPage_: {type: String, observer: 'selectedPageChanged_'}, | 37 selectedPage_: {type: String, observer: 'selectedPageChanged_'}, |
| 35 | 38 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 101 |
| 99 /** @override */ | 102 /** @override */ |
| 100 ready: function() { | 103 ready: function() { |
| 101 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); | 104 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); |
| 102 | 105 |
| 103 cr.ui.decorate('command', cr.ui.Command); | 106 cr.ui.decorate('command', cr.ui.Command); |
| 104 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); | 107 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); |
| 105 document.addEventListener('command', this.onCommand_.bind(this)); | 108 document.addEventListener('command', this.onCommand_.bind(this)); |
| 106 }, | 109 }, |
| 107 | 110 |
| 111 /** @override */ |
| 112 attached: function() { |
| 113 this.addWebUIListener('sign-in-state-updated', |
| 114 this.updateSignInState.bind(this)); |
| 115 }, |
| 116 |
| 108 onFirstRender: function() { | 117 onFirstRender: function() { |
| 109 setTimeout(function() { | 118 setTimeout(function() { |
| 110 chrome.send( | 119 chrome.send( |
| 111 'metricsHandler:recordTime', | 120 'metricsHandler:recordTime', |
| 112 ['History.ResultsRenderedTime', window.performance.now()]); | 121 ['History.ResultsRenderedTime', window.performance.now()]); |
| 113 }); | 122 }); |
| 114 | 123 |
| 115 // Focus the search field on load. Done here to ensure the history page | 124 // Focus the search field on load. Done here to ensure the history page |
| 116 // is rendered before we try to take focus. | 125 // is rendered before we try to take focus. |
| 117 var searchField = | 126 var searchField = |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 break; | 350 break; |
| 342 } | 351 } |
| 343 break; | 352 break; |
| 344 } | 353 } |
| 345 | 354 |
| 346 md_history.BrowserService.getInstance().recordHistogram( | 355 md_history.BrowserService.getInstance().recordHistogram( |
| 347 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END | 356 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END |
| 348 ); | 357 ); |
| 349 }, | 358 }, |
| 350 }); | 359 }); |
| OLD | NEW |