| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Send the history query immediately. This allows the query to process during | 5 // Send the history query immediately. This allows the query to process during |
| 6 // the initial page startup. | 6 // the initial page startup. |
| 7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); | 7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); |
| 8 chrome.send('getForeignSessions'); | 8 chrome.send('getForeignSessions'); |
| 9 | 9 |
| 10 /** @type {Promise} */ | 10 /** @type {Promise} */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Chrome Callbacks------------------------------------------------------------- | 32 // Chrome Callbacks------------------------------------------------------------- |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Our history system calls this function with results from searches. | 35 * Our history system calls this function with results from searches. |
| 36 * @param {HistoryQuery} info An object containing information about the query. | 36 * @param {HistoryQuery} info An object containing information about the query. |
| 37 * @param {!Array<HistoryEntry>} results A list of results. | 37 * @param {!Array<HistoryEntry>} results A list of results. |
| 38 */ | 38 */ |
| 39 function historyResult(info, results) { | 39 function historyResult(info, results) { |
| 40 waitForAppUpgrade().then(function() { | 40 waitForAppUpgrade().then(function() { |
| 41 /** @type {HistoryAppElement} */($('history-app')) | 41 var app = /** @type {HistoryAppElement} */($('history-app')); |
| 42 .historyResult(info, results); | 42 app.historyResult(info, results); |
| 43 document.body.classList.remove('loading'); | 43 document.body.classList.remove('loading'); |
| 44 | 44 |
| 45 if (!resultsRendered) { | 45 if (!resultsRendered) { |
| 46 resultsRendered = true; | 46 resultsRendered = true; |
| 47 // requestAnimationFrame allows measurement immediately before the next | 47 app.onFirstRender(); |
| 48 // repaint, but after the first page of <iron-list> items has stamped. | |
| 49 requestAnimationFrame(function() { | |
| 50 chrome.send( | |
| 51 'metricsHandler:recordTime', | |
| 52 ['History.ResultsRenderedTime', window.performance.now()]); | |
| 53 }); | |
| 54 } | 48 } |
| 55 }); | 49 }); |
| 56 } | 50 } |
| 57 | 51 |
| 58 /** | 52 /** |
| 59 * Called by the history backend after receiving results and after discovering | 53 * Called by the history backend after receiving results and after discovering |
| 60 * the existence of other forms of browsing history. | 54 * the existence of other forms of browsing history. |
| 61 * @param {boolean} hasSyncedResults Whether there are synced results. | 55 * @param {boolean} hasSyncedResults Whether there are synced results. |
| 62 * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include | 56 * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include |
| 63 * a sentence about the existence of other forms of browsing history. | 57 * a sentence about the existence of other forms of browsing history. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 /** | 94 /** |
| 101 * Called by the history backend after user's sign in state changes. | 95 * Called by the history backend after user's sign in state changes. |
| 102 * @param {boolean} isUserSignedIn Whether user is signed in or not now. | 96 * @param {boolean} isUserSignedIn Whether user is signed in or not now. |
| 103 */ | 97 */ |
| 104 function updateSignInState(isUserSignedIn) { | 98 function updateSignInState(isUserSignedIn) { |
| 105 waitForAppUpgrade().then(function() { | 99 waitForAppUpgrade().then(function() { |
| 106 /** @type {HistoryAppElement} */($('history-app')) | 100 /** @type {HistoryAppElement} */($('history-app')) |
| 107 .updateSignInState(isUserSignedIn); | 101 .updateSignInState(isUserSignedIn); |
| 108 }); | 102 }); |
| 109 } | 103 } |
| OLD | NEW |