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 cr.define('ntp', function() { | 9 cr.define('ntp', function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 this.sessions_ = sessionList; | 240 this.sessions_ = sessionList; |
241 this.resetMenuContents_(); | 241 this.resetMenuContents_(); |
242 if (sessionList.length > 0) { | 242 if (sessionList.length > 0) { |
243 // Rebuild the menu with the new data. | 243 // Rebuild the menu with the new data. |
244 for (var i = 0; i < sessionList.length; i++) { | 244 for (var i = 0; i < sessionList.length; i++) { |
245 this.addSession_(sessionList[i]); | 245 this.addSession_(sessionList[i]); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 // The menu button is shown iff tab sync is enabled. | 249 // The menu button is shown iff tab sync is enabled. |
250 this.hidden = !isTabSyncEnabled; | 250 this.classList.toggle('invisible', !isTabSyncEnabled); |
251 }, | 251 }, |
252 | 252 |
253 /** | 253 /** |
254 * Called when this element is initialized, and from the new tab page when | 254 * Called when this element is initialized, and from the new tab page when |
255 * the user's signed in state changes, | 255 * the user's signed in state changes, |
256 * @param {boolean} signedIn Is the user currently signed in? | 256 * @param {boolean} signedIn Is the user currently signed in? |
257 */ | 257 */ |
258 updateSignInState: function(signedIn) { | 258 updateSignInState: function(signedIn) { |
259 if (signedIn) | 259 if (signedIn) |
260 chrome.send('getForeignSessions'); | 260 chrome.send('getForeignSessions'); |
261 else | 261 else |
262 this.hidden = true; | 262 this.classList.add('invisible'); |
263 }, | 263 }, |
264 }; | 264 }; |
265 | 265 |
266 /** | 266 /** |
267 * Controller for the context menu for device names in the list of sessions. | 267 * Controller for the context menu for device names in the list of sessions. |
268 * This class is designed to be used as a singleton. | 268 * This class is designed to be used as a singleton. |
269 * | 269 * |
270 * @constructor | 270 * @constructor |
271 */ | 271 */ |
272 function DeviceContextMenuController() { | 272 function DeviceContextMenuController() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 updateMenuItems_: function() { | 352 updateMenuItems_: function() { |
353 this.collapseItem_.hidden = this.session_.collapsed; | 353 this.collapseItem_.hidden = this.session_.collapsed; |
354 this.expandItem_.hidden = !this.session_.collapsed; | 354 this.expandItem_.hidden = !this.session_.collapsed; |
355 } | 355 } |
356 }; | 356 }; |
357 | 357 |
358 return { | 358 return { |
359 OtherSessionsMenuButton: OtherSessionsMenuButton, | 359 OtherSessionsMenuButton: OtherSessionsMenuButton, |
360 }; | 360 }; |
361 }); | 361 }); |
OLD | NEW |