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

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

Issue 1619153002: MD History: Dynamically update synced tab data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@synced_history
Patch Set: rebase 4 chris Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index a2354e0dfb25392538249b1bac2de1d7259410ab..476a39378ad28d41682a5847ab0d4dbf80e6725a 100644
--- a/chrome/browser/resources/md_history/synced_device_manager.js
+++ b/chrome/browser/resources/md_history/synced_device_manager.js
@@ -17,19 +17,31 @@ Polymer({
* Re-organises the sessionList information.
*/
addSyncedHistory: function(sessionList) {
- // Does not add more items onto the page when the sessionList updates.
- // TODO(yingran) : update the cards dynamically by refreshing the tab list
- // and last update time for each synced tab card.
+ // Update synced device cards when the user modifies tabs in any synced
+ // device.
if (this.syncedDevices.length > 0) {
- return;
- }
-
- for (var i = 0; i < sessionList.length && sessionList[i].windows[0]; i++) {
- this.push('syncedDevices', {
- device: sessionList[i].name,
- lastUpdateTime: '- ' + sessionList[i].modifiedTime,
- tabs: sessionList[i].windows[0].tabs,
- });
+ var devices =
+ Polymer.dom(this.root).querySelectorAll('synced-device-card');
+ for (var i = 0; i < devices.length; i++) {
+ for (var j = 0; j < sessionList.length &&
+ sessionList[j].windows[0]; j++) {
+ if (devices[i].device == sessionList[j].name) {
+ devices[i].lastUpdateTime = '- ' + sessionList[j].modifiedTime;
+ devices[i].tabs = sessionList[j].windows[0].tabs;
+ sessionList.splice(j, 1);
+ }
+ }
+ }
+ // Sets up the initial synced device cards.
+ } else {
+ for (var i = 0; i < sessionList.length &&
+ sessionList[i].windows[0]; i++) {
+ this.push('syncedDevices', {
+ device: sessionList[i].name,
+ lastUpdateTime: '- ' + sessionList[i].modifiedTime,
+ tabs: sessionList[i].windows[0].tabs,
+ });
+ }
}
}
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698