| 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 var app = /** @type {HistoryAppElement} */($('history-app')); | 41 var app = /** @type {HistoryAppElement} */ ($('history-app')); |
| 42 app.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 app.onFirstRender(); | 47 app.onFirstRender(); |
| 48 } | 48 } |
| 49 }); | 49 }); |
| 50 } | 50 } |
| 51 | 51 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Receives the synced history data. An empty list means that either there are | 69 * Receives the synced history data. An empty list means that either there are |
| 70 * no foreign sessions, or tab sync is disabled for this profile. | 70 * no foreign sessions, or tab sync is disabled for this profile. |
| 71 * | 71 * |
| 72 * @param {!Array<!ForeignSession>} sessionList Array of objects describing the | 72 * @param {!Array<!ForeignSession>} sessionList Array of objects describing the |
| 73 * sessions from other devices. | 73 * sessions from other devices. |
| 74 */ | 74 */ |
| 75 function setForeignSessions(sessionList) { | 75 function setForeignSessions(sessionList) { |
| 76 waitForAppUpgrade().then(function() { | 76 waitForAppUpgrade().then(function() { |
| 77 /** @type {HistoryAppElement} */($('history-app')) | 77 /** @type {HistoryAppElement} */ ($('history-app')) |
| 78 .setForeignSessions(sessionList); | 78 .setForeignSessions(sessionList); |
| 79 }); | 79 }); |
| 80 } | 80 } |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Called when the history is deleted by someone else. | 83 * Called when the history is deleted by someone else. |
| 84 */ | 84 */ |
| 85 function historyDeleted() { | 85 function historyDeleted() { |
| 86 waitForAppUpgrade().then(function() { | 86 waitForAppUpgrade().then(function() { |
| 87 /** @type {HistoryAppElement} */($('history-app')) | 87 /** @type {HistoryAppElement} */ ($('history-app')).historyDeleted(); |
| 88 .historyDeleted(); | |
| 89 }); | 88 }); |
| 90 } | 89 } |
| 91 | 90 |
| 92 /** | 91 /** |
| 93 * Called by the history backend after user's sign in state changes. | 92 * Called by the history backend after user's sign in state changes. |
| 94 * @param {boolean} isUserSignedIn Whether user is signed in or not now. | 93 * @param {boolean} isUserSignedIn Whether user is signed in or not now. |
| 95 */ | 94 */ |
| 96 function updateSignInState(isUserSignedIn) { | 95 function updateSignInState(isUserSignedIn) { |
| 97 waitForAppUpgrade().then(function() { | 96 waitForAppUpgrade().then(function() { |
| 98 if ($('history-app')) { | 97 if ($('history-app')) { |
| 99 /** @type {HistoryAppElement} */($('history-app')) | 98 /** @type {HistoryAppElement} */ ($('history-app')) |
| 100 .updateSignInState(isUserSignedIn); | 99 .updateSignInState(isUserSignedIn); |
| 101 } | 100 } |
| 102 }); | 101 }); |
| 103 } | 102 } |
| OLD | NEW |