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

Side by Side Diff: chrome/browser/resources/md_history/synced_device_manager.js

Issue 2172563002: [MD History] Use openForeignSession message to open foreign session tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_menu_up
Patch Set: Created 4 years, 4 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 | « chrome/browser/resources/md_history/synced_device_manager.html ('k') | 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 /** 5 /**
6 * @typedef {{device: string, 6 * @typedef {{device: string,
7 * lastUpdateTime: string, 7 * lastUpdateTime: string,
8 * separatorIndexes: !Array<number>, 8 * separatorIndexes: !Array<number>,
9 * timestamp: number, 9 * timestamp: number,
10 * tabs: !Array<!ForeignSessionTab>, 10 * tabs: !Array<!ForeignSessionTab>,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }, 52 },
53 53
54 /** 54 /**
55 * @param {!ForeignSession} session 55 * @param {!ForeignSession} session
56 * @return {!ForeignDeviceInternal} 56 * @return {!ForeignDeviceInternal}
57 */ 57 */
58 createInternalDevice_: function(session) { 58 createInternalDevice_: function(session) {
59 var tabs = []; 59 var tabs = [];
60 var separatorIndexes = []; 60 var separatorIndexes = [];
61 for (var i = 0; i < session.windows.length; i++) { 61 for (var i = 0; i < session.windows.length; i++) {
62 var windowId = session.windows[i].sessionId;
62 var newTabs = session.windows[i].tabs; 63 var newTabs = session.windows[i].tabs;
63 if (newTabs.length == 0) 64 if (newTabs.length == 0)
64 continue; 65 continue;
65 66
67 newTabs.forEach(function(tab) {
68 tab.windowId = windowId;
69 });
66 70
67 if (!this.searchTerm) { 71 if (!this.searchTerm) {
68 // Add all the tabs if there is no search term. 72 // Add all the tabs if there is no search term.
69 tabs = tabs.concat(newTabs); 73 tabs = tabs.concat(newTabs);
70 separatorIndexes.push(tabs.length - 1); 74 separatorIndexes.push(tabs.length - 1);
71 } else { 75 } else {
72 var searchText = this.searchTerm.toLowerCase(); 76 var searchText = this.searchTerm.toLowerCase();
73 var windowAdded = false; 77 var windowAdded = false;
74 for (var j = 0; j < newTabs.length; j++) { 78 for (var j = 0; j < newTabs.length; j++) {
75 var tab = newTabs[j]; 79 var tab = newTabs[j];
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // User signed in, show the loading message when querying for synced 182 // User signed in, show the loading message when querying for synced
179 // devices. 183 // devices.
180 this.fetchingSyncedTabs_ = true; 184 this.fetchingSyncedTabs_ = true;
181 }, 185 },
182 186
183 searchTermChanged: function(searchTerm) { 187 searchTermChanged: function(searchTerm) {
184 this.clearDisplayedSyncedDevices_(); 188 this.clearDisplayedSyncedDevices_();
185 this.updateSyncedDevices(this.sessionList); 189 this.updateSyncedDevices(this.sessionList);
186 } 190 }
187 }); 191 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/synced_device_manager.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698