OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * @fileoverview The menu that shows tabs from sessions on other devices. | 6 * @fileoverview The menu that shows tabs from sessions on other devices. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * @typedef {{collapsed: boolean, | 10 * @typedef {{collapsed: boolean, |
11 * deviceType: string, | 11 * deviceType: string, |
12 * modifiedTime: string, | 12 * modifiedTime: string, |
13 * name: string, | 13 * name: string, |
14 * tag: string, | 14 * tag: string, |
15 * windows: Array.<WindowData>}} | 15 * windows: Array<WindowData>}} |
16 * @see chrome/browser/ui/webui/ntp/foreign_session_handler.cc | 16 * @see chrome/browser/ui/webui/ntp/foreign_session_handler.cc |
17 */ | 17 */ |
18 var SessionData; | 18 var SessionData; |
19 | 19 |
20 /** | 20 /** |
21 * @typedef {{sessionId: number, | 21 * @typedef {{sessionId: number, |
22 * tabs: Array, | 22 * tabs: Array, |
23 * timestamp: number, | 23 * timestamp: number, |
24 * type: string, | 24 * type: string, |
25 * userVisibleTimestamp: string}} | 25 * userVisibleTimestamp: string}} |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 | 251 |
252 return contents; | 252 return contents; |
253 }, | 253 }, |
254 | 254 |
255 /** | 255 /** |
256 * Sets the menu model data. An empty list means that either there are no | 256 * Sets the menu model data. An empty list means that either there are no |
257 * foreign sessions, or tab sync is disabled for this profile. | 257 * foreign sessions, or tab sync is disabled for this profile. |
258 * |isTabSyncEnabled| makes it possible to distinguish between the cases. | 258 * |isTabSyncEnabled| makes it possible to distinguish between the cases. |
259 * | 259 * |
260 * @param {Array.<SessionData>} sessionList Array of objects describing the | 260 * @param {Array<SessionData>} sessionList Array of objects describing the |
261 * sessions from other devices. | 261 * sessions from other devices. |
262 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 262 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
263 */ | 263 */ |
264 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 264 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
265 this.sessions_ = sessionList; | 265 this.sessions_ = sessionList; |
266 this.resetMenuContents_(); | 266 this.resetMenuContents_(); |
267 if (sessionList.length > 0) { | 267 if (sessionList.length > 0) { |
268 // Rebuild the menu with the new data. | 268 // Rebuild the menu with the new data. |
269 for (var i = 0; i < sessionList.length; i++) { | 269 for (var i = 0; i < sessionList.length; i++) { |
270 this.addSession_(sessionList[i]); | 270 this.addSession_(sessionList[i]); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 updateMenuItems_: function() { | 377 updateMenuItems_: function() { |
378 this.collapseItem_.hidden = this.session_.collapsed; | 378 this.collapseItem_.hidden = this.session_.collapsed; |
379 this.expandItem_.hidden = !this.session_.collapsed; | 379 this.expandItem_.hidden = !this.session_.collapsed; |
380 } | 380 } |
381 }; | 381 }; |
382 | 382 |
383 return { | 383 return { |
384 OtherSessionsMenuButton: OtherSessionsMenuButton, | 384 OtherSessionsMenuButton: OtherSessionsMenuButton, |
385 }; | 385 }; |
386 }); | 386 }); |
OLD | NEW |