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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'synced-device-manager', 6 is: 'synced-device-manager',
7 7
8 properties: { 8 properties: {
9 // An array of synced devices with synced tab data. 9 // An array of synced devices with synced tab data.
10 syncedDevices: { 10 syncedDevices: {
11 type: Array, 11 type: Array,
12 value: [] 12 value: []
13 } 13 }
14 }, 14 },
15 15
16 /** 16 /**
17 * Re-organises the sessionList information. 17 * Re-organises the sessionList information.
18 */ 18 */
19 addSyncedHistory: function(sessionList) { 19 addSyncedHistory: function(sessionList) {
20 // Does not add more items onto the page when the sessionList updates. 20 // Update synced device cards when the user modifies tabs in any synced
21 // TODO(yingran) : update the cards dynamically by refreshing the tab list 21 // device.
22 // and last update time for each synced tab card.
23 if (this.syncedDevices.length > 0) { 22 if (this.syncedDevices.length > 0) {
24 return; 23 var devices =
25 } 24 Polymer.dom(this.root).querySelectorAll('synced-device-card');
26 25 for (var i = 0; i < devices.length; i++) {
27 for (var i = 0; i < sessionList.length && sessionList[i].windows[0]; i++) { 26 for (var j = 0; j < sessionList.length &&
28 this.push('syncedDevices', { 27 sessionList[j].windows[0]; j++) {
29 device: sessionList[i].name, 28 if (devices[i].device == sessionList[j].name) {
30 lastUpdateTime: '- ' + sessionList[i].modifiedTime, 29 devices[i].lastUpdateTime = '- ' + sessionList[j].modifiedTime;
31 tabs: sessionList[i].windows[0].tabs, 30 devices[i].tabs = sessionList[j].windows[0].tabs;
32 }); 31 sessionList.splice(j, 1);
32 }
33 }
34 }
35 // Sets up the initial synced device cards.
36 } else {
37 for (var i = 0; i < sessionList.length &&
38 sessionList[i].windows[0]; i++) {
39 this.push('syncedDevices', {
40 device: sessionList[i].name,
41 lastUpdateTime: '- ' + sessionList[i].modifiedTime,
42 tabs: sessionList[i].windows[0].tabs,
43 });
44 }
33 } 45 }
34 } 46 }
35 }); 47 });
OLDNEW
« 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