Chromium Code Reviews| 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 dc695a289facd4a5e19ec30fa2c2a5ff4fbab51d..8df2e9c34e55f67c39e22878beb2ac26fbfed7c2 100644 |
| --- a/chrome/browser/resources/md_history/history.js |
| +++ b/chrome/browser/resources/md_history/history.js |
| @@ -12,10 +12,6 @@ |
| */ |
| var BROWSING_GAP_TIME = 15 * 60 * 1000; |
| -window.addEventListener('load', function() { |
| - chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); |
| -}); |
| - |
| /** |
| * Listens for history-item being selected or deselected (through checkbox) |
| * and changes the view of the top toolbar. |
| @@ -67,6 +63,19 @@ window.addEventListener('resize', function() { |
| $('history-list').closeMenu(); |
| }); |
| +/** |
| + * Switches between displaying history data and synced tabs data for the page. |
| + */ |
| +window.addEventListener('switch-display', function(e) { |
| + $('synced-device-manager').hidden = e.detail.display != 'synced-tabs-button'; |
|
tsergeant
2016/03/01 03:58:22
Did you experiment with using something other than
calamity
2016/03/08 02:46:51
I looked into it. It didn't work out so well. This
|
| + $('history-list').hidden = e.detail.display != 'history-button'; |
| +}); |
| + |
| +window.addEventListener('load', function() { |
| + chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); |
| + chrome.send('getForeignSessions'); |
| +}); |
| + |
| // Chrome Callbacks------------------------------------------------------------- |
| /** |
| @@ -81,6 +90,22 @@ 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. |
|
tsergeant
2016/03/01 03:58:22
This means that it's possible to have no foreign s
calamity
2016/03/08 02:46:51
Good pointâ„¢.
|
| + * |isTabSyncEnabled| makes it possible to distinguish between the cases. |
| + * |
| + * @param {Array<Session>} sessionList Array of objects describing the sessions |
| + * from other devices. |
| + * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| + */ |
| +function setForeignSessions(sessionList, isTabSyncEnabled) { |
| + $('side-bar').hidden = !isTabSyncEnabled; |
| + if (isTabSyncEnabled) { |
|
tsergeant
2016/03/01 03:58:22
Nit: {}
calamity
2016/03/08 02:46:51
Done.
|
| + $('synced-device-manager').addSyncedHistory(sessionList); |
| + } |
| +} |
| + |
| +/** |
| * Called by the history backend when deletion was succesful. |
| */ |
| function deleteComplete() { |