| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 waitForAppUpgrade().then(function() { | 61 waitForAppUpgrade().then(function() { |
| 62 var app = /** @type {HistoryAppElement} */ ($('history-app')); | 62 var app = /** @type {HistoryAppElement} */ ($('history-app')); |
| 63 app.showSidebarFooter = includeOtherFormsOfBrowsingHistory; | 63 app.showSidebarFooter = includeOtherFormsOfBrowsingHistory; |
| 64 app.hasSyncedResults = hasSyncedResults; | 64 app.hasSyncedResults = hasSyncedResults; |
| 65 }); | 65 }); |
| 66 } | 66 } |
| 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 * |isTabSyncEnabled| makes it possible to distinguish between the cases. | |
| 72 * | 71 * |
| 73 * @param {!Array<!ForeignSession>} sessionList Array of objects describing the | 72 * @param {!Array<!ForeignSession>} sessionList Array of objects describing the |
| 74 * sessions from other devices. | 73 * sessions from other devices. |
| 75 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | |
| 76 */ | 74 */ |
| 77 function setForeignSessions(sessionList, isTabSyncEnabled) { | 75 function setForeignSessions(sessionList) { |
| 78 waitForAppUpgrade().then(function() { | 76 waitForAppUpgrade().then(function() { |
| 79 /** @type {HistoryAppElement} */($('history-app')) | 77 /** @type {HistoryAppElement} */($('history-app')) |
| 80 .setForeignSessions(sessionList, isTabSyncEnabled); | 78 .setForeignSessions(sessionList); |
| 81 }); | 79 }); |
| 82 } | 80 } |
| 83 | 81 |
| 84 /** | 82 /** |
| 85 * Called when the history is deleted by someone else. | 83 * Called when the history is deleted by someone else. |
| 86 */ | 84 */ |
| 87 function historyDeleted() { | 85 function historyDeleted() { |
| 88 waitForAppUpgrade().then(function() { | 86 waitForAppUpgrade().then(function() { |
| 89 /** @type {HistoryAppElement} */($('history-app')) | 87 /** @type {HistoryAppElement} */($('history-app')) |
| 90 .historyDeleted(); | 88 .historyDeleted(); |
| 91 }); | 89 }); |
| 92 } | 90 } |
| 93 | 91 |
| 94 /** | 92 /** |
| 95 * Called by the history backend after user's sign in state changes. | 93 * Called by the history backend after user's sign in state changes. |
| 96 * @param {boolean} isUserSignedIn Whether user is signed in or not now. | 94 * @param {boolean} isUserSignedIn Whether user is signed in or not now. |
| 97 */ | 95 */ |
| 98 function updateSignInState(isUserSignedIn) { | 96 function updateSignInState(isUserSignedIn) { |
| 99 waitForAppUpgrade().then(function() { | 97 waitForAppUpgrade().then(function() { |
| 100 if ($('history-app')) { | 98 if ($('history-app')) { |
| 101 /** @type {HistoryAppElement} */($('history-app')) | 99 /** @type {HistoryAppElement} */($('history-app')) |
| 102 .updateSignInState(isUserSignedIn); | 100 .updateSignInState(isUserSignedIn); |
| 103 } | 101 } |
| 104 }); | 102 }); |
| 105 } | 103 } |
| OLD | NEW |