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

Unified Diff: chrome/browser/resources/md_history/synced_device_manager.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_comments 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/synced_device_manager.js
diff --git a/chrome/browser/resources/md_history/synced_device_manager.js b/chrome/browser/resources/md_history/synced_device_manager.js
new file mode 100644
index 0000000000000000000000000000000000000000..6ed8058ca0bf64fe9ff95a88d164d880c36b0b80
--- /dev/null
+++ b/chrome/browser/resources/md_history/synced_device_manager.js
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'history-synced-device-manager',
+
+ properties: {
+ /**
+ * An array of synced devices with synced tab data.
+ * @type {!Array<!{device: string,
+ * lastUpdateTime: string,
+ * tabs: !Array<!ForeignSessionTab>}>}
+ */
+ syncedDevices: {
+ type: Array,
+ value: function() { return []; }
+ }
+ },
+
+ /**
+ * Adds |sessionList| to the currently displayed synced tabs.
+ * @param {!Array<!ForeignSession>} sessionList
+ */
+ addSyncedHistory: function(sessionList) {
+ // TODO(calamity): Does not add more items onto the page when the
+ // sessionList updates. Update the cards dynamically by refreshing the tab
+ // list and last update time for each synced tab card.
+ if (this.syncedDevices.length > 0)
+ return;
+
+ for (var i = 0; i < sessionList.length; i++) {
+ var tabs = [];
+ for (var j = 0; j < sessionList[i].windows.length; j++) {
+ var newTabs = sessionList[i].windows[j].tabs;
+ if (newTabs.length == 0)
+ continue;
+
+ tabs = tabs.concat(newTabs);
+ tabs[tabs.length - 1].needsWindowSeparator = true;
+ }
+
+ this.push('syncedDevices', {
+ device: sessionList[i].name,
+ lastUpdateTime: '– ' + sessionList[i].modifiedTime,
+ tabs: tabs,
+ });
+ }
+ }
+});
« no previous file with comments | « chrome/browser/resources/md_history/synced_device_manager.html ('k') | chrome/browser/ui/webui/md_history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698