Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6436)

Unified Diff: chrome/browser/resources/md_history/history.js

Issue 1729263005: MD History: Display synced tabs history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mdh_shared_styles
Patch Set: address nit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..51833f0eb07e72baf80f502f5903b8d1c9a563f0 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<Session>} sessionList Array of objects describing the sessions
Dan Beam 2016/03/10 18:57:15 nit: unless this Array can be null or any of the s
calamity 2016/03/14 02:29:39 Done.
+ * 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} */ (
Dan Beam 2016/03/10 18:57:14 nit: /** @type {HistorySyncedDeviceManagerElement}
calamity 2016/03/14 02:29:39 Done.
+ $('history-synced-device-manager'));
+ syncedDeviceManager.addSyncedHistory(sessionList);
+ }
+}
+
+/**
* Called by the history backend when deletion was succesful.
*/
function deleteComplete() {

Powered by Google App Engine
This is Rietveld 408576698