| Index: chrome/browser/resources/md_history/history.js
|
| diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js
|
| index 8279522f675f6eac33c75d1f56fb504f9b04d6d9..d31aa0ed004afe04fc2e6f89d279d43252a01a54 100644
|
| --- a/chrome/browser/resources/md_history/history.js
|
| +++ b/chrome/browser/resources/md_history/history.js
|
| @@ -4,6 +4,7 @@
|
|
|
| window.addEventListener('load', function() {
|
| chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]);
|
| + chrome.send('getForeignSessions');
|
| });
|
|
|
| /**
|
| @@ -44,7 +45,6 @@ window.addEventListener('delete-selected', function() {
|
| chrome.send('removeVisits', toBeRemoved);
|
| });
|
|
|
| -
|
| /**
|
| * When the search is changed refresh the results from the backend.
|
| */
|
| @@ -53,6 +53,15 @@ window.addEventListener('search-changed', function(e) {
|
| chrome.send('queryHistory', [e.detail.search, 0, 0, 0, RESULTS_PER_PAGE]);
|
| });
|
|
|
| +/**
|
| + * Switches between displaying history data and synced tabs data for the page.
|
| + */
|
| +window.addEventListener('switch-display', function(e) {
|
| + $('history-synced-device-manager').hidden =
|
| + e.detail.display != 'synced-tabs-button';
|
| + $('history-list').hidden = e.detail.display != 'history-button';
|
| +});
|
| +
|
| // Chrome Callbacks-------------------------------------------------------------
|
|
|
| /**
|
| @@ -68,6 +77,25 @@ function historyResult(info, results) {
|
| }
|
|
|
| /**
|
| + * Receives the synced history data. An empty list means that either there are
|
| + * no foreign sessions, or tab sync is disabled for this profile.
|
| + * |isTabSyncEnabled| makes it possible to distinguish between the cases.
|
| + *
|
| + * @param {!Array<!ForeignSession>} sessionList Array of objects describing the
|
| + * sessions from other devices.
|
| + * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile?
|
| + */
|
| +function setForeignSessions(sessionList, isTabSyncEnabled) {
|
| + // TODO(calamity): Add a 'no synced devices' message when sessions are empty.
|
| + $('history-side-bar').hidden = !isTabSyncEnabled;
|
| + if (isTabSyncEnabled) {
|
| + var syncedDeviceManager = /** @type {HistorySyncedDeviceManagerElement} */(
|
| + $('history-synced-device-manager'));
|
| + syncedDeviceManager.addSyncedHistory(sessionList);
|
| + }
|
| +}
|
| +
|
| +/**
|
| * Called by the history backend when deletion was succesful.
|
| */
|
| function deleteComplete() {
|
|
|