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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 this.sessions_ = sessionList; | 238 this.sessions_ = sessionList; |
239 this.resetMenuContents_(); | 239 this.resetMenuContents_(); |
240 if (sessionList.length > 0) { | 240 if (sessionList.length > 0) { |
241 // Rebuild the menu with the new data. | 241 // Rebuild the menu with the new data. |
242 for (var i = 0; i < sessionList.length; i++) { | 242 for (var i = 0; i < sessionList.length; i++) { |
243 this.addSession_(sessionList[i]); | 243 this.addSession_(sessionList[i]); |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 // The menu button is shown iff tab sync is enabled. | 247 // The menu button is shown iff tab sync is enabled. |
248 this.hidden = !isTabSyncEnabled; | 248 if (isTabSyncEnabled) |
Dan Beam
2013/01/31 20:22:11
if we end up keeping .invisible
this.classList.
dconnelly
2013/02/04 16:40:45
This doesn't work. It coerces the first argument
Dan Beam
2013/02/04 19:01:10
sorry, meant:
this.classList.toggle('invisible', i
| |
249 this.classList.remove('invisible'); | |
250 else | |
251 this.classList.add('invisible'); | |
249 }, | 252 }, |
250 | 253 |
251 /** | 254 /** |
252 * Called when this element is initialized, and from the new tab page when | 255 * Called when this element is initialized, and from the new tab page when |
253 * the user's signed in state changes, | 256 * the user's signed in state changes, |
254 * @param {boolean} signedIn Is the user currently signed in? | 257 * @param {boolean} signedIn Is the user currently signed in? |
255 */ | 258 */ |
256 updateSignInState: function(signedIn) { | 259 updateSignInState: function(signedIn) { |
257 if (signedIn) | 260 if (signedIn) |
258 chrome.send('getForeignSessions'); | 261 chrome.send('getForeignSessions'); |
259 else | 262 else |
260 this.hidden = true; | 263 this.classList.add('invisible'); |
261 }, | 264 }, |
262 }; | 265 }; |
263 | 266 |
264 /** | 267 /** |
265 * Controller for the context menu for device names in the list of sessions. | 268 * Controller for the context menu for device names in the list of sessions. |
266 * This class is designed to be used as a singleton. | 269 * This class is designed to be used as a singleton. |
267 * | 270 * |
268 * @constructor | 271 * @constructor |
269 */ | 272 */ |
270 function DeviceContextMenuController() { | 273 function DeviceContextMenuController() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 updateMenuItems_: function() { | 353 updateMenuItems_: function() { |
351 this.collapseItem_.hidden = this.session_.collapsed; | 354 this.collapseItem_.hidden = this.session_.collapsed; |
352 this.expandItem_.hidden = !this.session_.collapsed; | 355 this.expandItem_.hidden = !this.session_.collapsed; |
353 } | 356 } |
354 }; | 357 }; |
355 | 358 |
356 return { | 359 return { |
357 OtherSessionsMenuButton: OtherSessionsMenuButton, | 360 OtherSessionsMenuButton: OtherSessionsMenuButton, |
358 }; | 361 }; |
359 }); | 362 }); |
OLD | NEW |