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 | 6 * @fileoverview |
7 * Class representing the client tool-bar. | 7 * Class representing the client tool-bar. |
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} toolbar The HTML element representing the tool-bar. | 16 * @param {HTMLElement} toolbar The HTML element representing the tool-bar. |
17 * @constructor | 17 * @constructor |
18 */ | 18 */ |
19 remoting.Toolbar = function(toolbar) { | 19 remoting.Toolbar = function(toolbar) { |
20 /** | 20 /** @private {HTMLElement} */ |
21 * @type {HTMLElement} | |
22 * @private | |
23 */ | |
24 this.toolbar_ = toolbar; | 21 this.toolbar_ = toolbar; |
25 /** | 22 /** @private {HTMLElement} */ |
26 * @type {HTMLElement} | |
27 * @private | |
28 */ | |
29 this.stub_ = | 23 this.stub_ = |
30 /** @type {HTMLElement} */(toolbar.querySelector('.toolbar-stub')); | 24 /** @type {HTMLElement} */(toolbar.querySelector('.toolbar-stub')); |
31 /** | 25 /** @private {number?} The id of the preview timer, if any. */ |
32 * @type {number?} The id of the preview timer, if any. | |
33 * @private | |
34 */ | |
35 this.timerId_ = null; | 26 this.timerId_ = null; |
36 /** | 27 /** @private {number} Left edge of the toolbar stub, updated on resize. */ |
37 * @type {number} The left edge of the tool-bar stub, updated on resize. | |
38 * @private | |
39 */ | |
40 this.stubLeft_ = 0; | 28 this.stubLeft_ = 0; |
41 /** | 29 /** @private {number} Right edge of the toolbar stub, updated on resize. */ |
42 * @type {number} The right edge of the tool-bar stub, updated on resize. | |
43 * @private | |
44 */ | |
45 this.stubRight_ = 0; | 30 this.stubRight_ = 0; |
46 | 31 |
47 /** | 32 /** @private {remoting.MenuButton} */ |
48 * @type {remoting.MenuButton} | |
49 * @private | |
50 */ | |
51 this.screenOptionsMenu_ = new remoting.MenuButton( | 33 this.screenOptionsMenu_ = new remoting.MenuButton( |
52 document.getElementById('screen-options-menu'), | 34 document.getElementById('screen-options-menu'), |
53 this.onShowOptionsMenu_.bind(this)); | 35 this.onShowOptionsMenu_.bind(this)); |
54 /** | 36 /** @private {remoting.MenuButton} */ |
55 * @type {remoting.MenuButton} | |
56 * @private | |
57 */ | |
58 this.sendKeysMenu_ = new remoting.MenuButton( | 37 this.sendKeysMenu_ = new remoting.MenuButton( |
59 document.getElementById('send-keys-menu') | 38 document.getElementById('send-keys-menu') |
60 ); | 39 ); |
61 | 40 |
62 | 41 |
63 window.addEventListener('mousemove', remoting.Toolbar.onMouseMove, false); | 42 window.addEventListener('mousemove', remoting.Toolbar.onMouseMove, false); |
64 window.addEventListener('resize', this.center.bind(this), false); | 43 window.addEventListener('resize', this.center.bind(this), false); |
65 | 44 |
66 registerEventListener('toolbar-disconnect', 'click', | 45 registerEventListener('toolbar-disconnect', 'click', |
67 remoting.app.disconnect.bind(remoting.app)); | 46 remoting.app.disconnect.bind(remoting.app)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 remoting.optionsMenu.onShow(); | 168 remoting.optionsMenu.onShow(); |
190 }; | 169 }; |
191 | 170 |
192 /** @type {remoting.Toolbar} */ | 171 /** @type {remoting.Toolbar} */ |
193 remoting.toolbar = null; | 172 remoting.toolbar = null; |
194 | 173 |
195 /** @private */ | 174 /** @private */ |
196 remoting.Toolbar.STUB_EXTENDED_CLASS_ = 'toolbar-stub-extended'; | 175 remoting.Toolbar.STUB_EXTENDED_CLASS_ = 'toolbar-stub-extended'; |
197 /** @private */ | 176 /** @private */ |
198 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible'; | 177 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible'; |
OLD | NEW |