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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 this.menu = new Menu; | 48 this.menu = new Menu; |
49 cr.ui.decorate(this.menu, Menu); | 49 cr.ui.decorate(this.menu, Menu); |
50 this.menu.classList.add('footer-menu'); | 50 this.menu.classList.add('footer-menu'); |
51 this.menu.addEventListener('contextmenu', | 51 this.menu.addEventListener('contextmenu', |
52 this.onContextMenu_.bind(this), true); | 52 this.onContextMenu_.bind(this), true); |
53 document.body.appendChild(this.menu); | 53 document.body.appendChild(this.menu); |
54 | 54 |
55 // Create the context menu that appears when the user right clicks | 55 // Create the context menu that appears when the user right clicks |
56 // on a device name. | 56 // on a device name. |
57 this.deviceContextMenu_ = DeviceContextMenuController.getInstance().menu; | 57 this.deviceContextMenu_ = DeviceContextMenuController.getInstance().menu; |
58 this.deviceContextMenu_.style.display = 'none'; | |
59 document.body.appendChild(this.deviceContextMenu_); | 58 document.body.appendChild(this.deviceContextMenu_); |
60 | 59 |
61 this.promoMessage_ = $('other-sessions-promo-template').cloneNode(true); | 60 this.promoMessage_ = $('other-sessions-promo-template').cloneNode(true); |
62 this.promoMessage_.removeAttribute('id'); // Prevent a duplicate id. | 61 this.promoMessage_.removeAttribute('id'); // Prevent a duplicate id. |
63 | 62 |
64 this.sessions_ = []; | 63 this.sessions_ = []; |
65 this.anchorType = cr.ui.AnchorType.ABOVE; | 64 this.anchorType = cr.ui.AnchorType.ABOVE; |
66 this.invertLeftRight = true; | 65 this.invertLeftRight = true; |
67 | 66 |
68 // Initialize the images for the drop-down buttons that appear beside the | 67 // Initialize the images for the drop-down buttons that appear beside the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 99 } |
101 } | 100 } |
102 }, | 101 }, |
103 | 102 |
104 /** | 103 /** |
105 * Hides the menu. | 104 * Hides the menu. |
106 * @override | 105 * @override |
107 */ | 106 */ |
108 hideMenu: function() { | 107 hideMenu: function() { |
109 // Don't hide if the device context menu is currently showing. | 108 // Don't hide if the device context menu is currently showing. |
110 if (this.deviceContextMenu_.style.display == 'none') | 109 if (this.deviceContextMenu_.hidden) |
111 MenuButton.prototype.hideMenu.call(this); | 110 MenuButton.prototype.hideMenu.call(this); |
112 }, | 111 }, |
113 | 112 |
114 /** | 113 /** |
115 * Shows the menu, first rebuilding it if necessary. | 114 * Shows the menu, first rebuilding it if necessary. |
116 * TODO(estade): the right of the menu should align with the right of the | 115 * TODO(estade): the right of the menu should align with the right of the |
117 * button. | 116 * button. |
118 * @override | 117 * @override |
119 */ | 118 */ |
120 showMenu: function() { | 119 showMenu: function() { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 updateMenuItems_: function() { | 352 updateMenuItems_: function() { |
354 this.collapseItem_.hidden = this.session_.collapsed; | 353 this.collapseItem_.hidden = this.session_.collapsed; |
355 this.expandItem_.hidden = !this.session_.collapsed; | 354 this.expandItem_.hidden = !this.session_.collapsed; |
356 } | 355 } |
357 }; | 356 }; |
358 | 357 |
359 return { | 358 return { |
360 OtherSessionsMenuButton: OtherSessionsMenuButton, | 359 OtherSessionsMenuButton: OtherSessionsMenuButton, |
361 }; | 360 }; |
362 }); | 361 }); |
OLD | NEW |