OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 6 * @fileoverview |
7 * Apps v2 custom title bar implementation | 7 * Apps v2 custom title bar implementation |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
11 | 11 |
12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
14 | 14 |
15 /** | 15 /** |
16 * @param {HTMLElement} titleBar The root node of the title-bar DOM hierarchy. | 16 * @param {HTMLElement} titleBar The root node of the title-bar DOM hierarchy. |
17 * @constructor | 17 * @constructor |
18 */ | 18 */ |
19 remoting.WindowFrame = function(titleBar) { | 19 remoting.WindowFrame = function(titleBar) { |
20 /** | 20 /** @private {remoting.DesktopConnectedView} */ |
21 * @type {remoting.DesktopConnectedView} | |
22 * @private | |
23 */ | |
24 this.desktopConnectedView_ = null; | 21 this.desktopConnectedView_ = null; |
25 | 22 |
26 /** | 23 /** @private {HTMLElement} */ |
27 * @type {HTMLElement} | |
28 * @private | |
29 */ | |
30 this.titleBar_ = titleBar; | 24 this.titleBar_ = titleBar; |
31 | 25 |
32 /** | 26 /** @private {HTMLElement} */ |
33 * @type {HTMLElement} | |
34 * @private | |
35 */ | |
36 this.title_ = /** @type {HTMLElement} */ | 27 this.title_ = /** @type {HTMLElement} */ |
37 (titleBar.querySelector('.window-title')); | 28 (titleBar.querySelector('.window-title')); |
38 base.debug.assert(this.title_ != null); | 29 base.debug.assert(this.title_ != null); |
39 | 30 |
40 /** | 31 /** @private {HTMLElement} */ |
41 * @type {HTMLElement} | |
42 * @private | |
43 */ | |
44 this.maximizeRestoreControl_ = /** @type {HTMLElement} */ | 32 this.maximizeRestoreControl_ = /** @type {HTMLElement} */ |
45 (titleBar.querySelector('.window-maximize-restore')); | 33 (titleBar.querySelector('.window-maximize-restore')); |
46 base.debug.assert(this.maximizeRestoreControl_ != null); | 34 base.debug.assert(this.maximizeRestoreControl_ != null); |
47 | 35 |
48 var optionsButton = titleBar.querySelector('.window-options'); | 36 var optionsButton = titleBar.querySelector('.window-options'); |
49 base.debug.assert(optionsButton != null); | 37 base.debug.assert(optionsButton != null); |
50 this.optionMenuButton_ = new remoting.MenuButton( | 38 this.optionMenuButton_ = new remoting.MenuButton( |
51 optionsButton, | 39 optionsButton, |
52 this.onShowOptionsMenu_.bind(this), | 40 this.onShowOptionsMenu_.bind(this), |
53 this.onHideOptionsMenu_.bind(this)); | 41 this.onHideOptionsMenu_.bind(this)); |
54 | 42 |
55 /** | 43 /** @private {HTMLElement} */ |
56 * @type {HTMLElement} | |
57 * @private | |
58 */ | |
59 this.optionsMenuList_ = /** @type {HTMLElement} */ | 44 this.optionsMenuList_ = /** @type {HTMLElement} */ |
60 (optionsButton.querySelector('.window-options-menu')); | 45 (optionsButton.querySelector('.window-options-menu')); |
61 base.debug.assert(this.optionsMenuList_ != null); | 46 base.debug.assert(this.optionsMenuList_ != null); |
62 | 47 |
63 /** | 48 /** |
64 * @type {Array<{cls:string, fn: function()}>} | 49 * @type {Array<{cls:string, fn: function()}>} |
65 */ | 50 */ |
66 var handlers = [ | 51 var handlers = [ |
67 { cls: 'window-disconnect', fn: this.disconnectSession_.bind(this) }, | 52 { cls: 'window-disconnect', fn: this.disconnectSession_.bind(this) }, |
68 { cls: 'window-maximize-restore', | 53 { cls: 'window-maximize-restore', |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 var hidePreview = function() { | 226 var hidePreview = function() { |
242 target.classList.remove('preview'); | 227 target.classList.remove('preview'); |
243 }; | 228 }; |
244 target.classList.add('preview'); | 229 target.classList.add('preview'); |
245 window.setTimeout(hidePreview, kPreviewTimeoutMs); | 230 window.setTimeout(hidePreview, kPreviewTimeoutMs); |
246 }; | 231 }; |
247 | 232 |
248 | 233 |
249 /** @type {remoting.WindowFrame} */ | 234 /** @type {remoting.WindowFrame} */ |
250 remoting.windowFrame = null; | 235 remoting.windowFrame = null; |
OLD | NEW |