Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: remoting/webapp/crd/js/toolbar.js

Issue 1082383002: [Webapp Refactor] Remove remoting.clientSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser tests Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/js/smart_reconnector.js ('k') | remoting/webapp/crd/js/window_frame.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * @param {function()} disconnectCallback Callback for disconnecting the
18 * session.
17 * @constructor 19 * @constructor
18 */ 20 */
19 remoting.Toolbar = function(toolbar) { 21 remoting.Toolbar = function(toolbar, disconnectCallback) {
20 /** @private {HTMLElement} */ 22 /** @private {HTMLElement} */
21 this.toolbar_ = toolbar; 23 this.toolbar_ = toolbar;
22 /** @private {HTMLElement} */ 24 /** @private {HTMLElement} */
23 this.stub_ = 25 this.stub_ =
24 /** @type {HTMLElement} */(toolbar.querySelector('.toolbar-stub')); 26 /** @type {HTMLElement} */(toolbar.querySelector('.toolbar-stub'));
25 /** @private {number?} The id of the preview timer, if any. */ 27 /** @private {number?} The id of the preview timer, if any. */
26 this.timerId_ = null; 28 this.timerId_ = null;
27 /** @private {number} Left edge of the toolbar stub, updated on resize. */ 29 /** @private {number} Left edge of the toolbar stub, updated on resize. */
28 this.stubLeft_ = 0; 30 this.stubLeft_ = 0;
29 /** @private {number} Right edge of the toolbar stub, updated on resize. */ 31 /** @private {number} Right edge of the toolbar stub, updated on resize. */
30 this.stubRight_ = 0; 32 this.stubRight_ = 0;
31 33
32 /** @private {remoting.MenuButton} */ 34 /** @private {remoting.MenuButton} */
33 this.screenOptionsMenu_ = new remoting.MenuButton( 35 this.screenOptionsMenu_ = new remoting.MenuButton(
34 document.getElementById('screen-options-menu'), 36 document.getElementById('screen-options-menu'),
35 this.onShowOptionsMenu_.bind(this)); 37 this.onShowOptionsMenu_.bind(this));
36 /** @private {remoting.MenuButton} */ 38 /** @private {remoting.MenuButton} */
37 this.sendKeysMenu_ = new remoting.MenuButton( 39 this.sendKeysMenu_ = new remoting.MenuButton(
38 document.getElementById('send-keys-menu') 40 document.getElementById('send-keys-menu')
39 ); 41 );
40 42
41 43
42 window.addEventListener('mousemove', remoting.Toolbar.onMouseMove, false); 44 window.addEventListener('mousemove', remoting.Toolbar.onMouseMove, false);
43 window.addEventListener('resize', this.center.bind(this), false); 45 window.addEventListener('resize', this.center.bind(this), false);
44 46
45 registerEventListener('toolbar-disconnect', 'click', 47 registerEventListener('toolbar-disconnect', 'click', disconnectCallback);
46 remoting.app.disconnect.bind(remoting.app));
47 registerEventListener('toolbar-stub', 48 registerEventListener('toolbar-stub',
48 'click', function() { remoting.toolbar.toggle(); }); 49 'click', function() { remoting.toolbar.toggle(); });
49 50
50 // Prevent the preview canceling if the user is interacting with the tool-bar. 51 // Prevent the preview canceling if the user is interacting with the tool-bar.
51 /** @type {remoting.Toolbar} */ 52 /** @type {remoting.Toolbar} */
52 var that = this; 53 var that = this;
53 var stopTimer = function() { 54 var stopTimer = function() {
54 if (that.timerId_) { 55 if (that.timerId_) {
55 window.clearTimeout(that.timerId_); 56 window.clearTimeout(that.timerId_);
56 that.timerId_ = null; 57 that.timerId_ = null;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 remoting.optionsMenu.onShow(); 169 remoting.optionsMenu.onShow();
169 }; 170 };
170 171
171 /** @type {remoting.Toolbar} */ 172 /** @type {remoting.Toolbar} */
172 remoting.toolbar = null; 173 remoting.toolbar = null;
173 174
174 /** @private */ 175 /** @private */
175 remoting.Toolbar.STUB_EXTENDED_CLASS_ = 'toolbar-stub-extended'; 176 remoting.Toolbar.STUB_EXTENDED_CLASS_ = 'toolbar-stub-extended';
176 /** @private */ 177 /** @private */
177 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible'; 178 remoting.Toolbar.VISIBLE_CLASS_ = 'toolbar-visible';
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/smart_reconnector.js ('k') | remoting/webapp/crd/js/window_frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698