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

Side by Side Diff: remoting/webapp/crd/js/window_frame.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/toolbar.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * @param {function()} disconnectCallback Callback for disconnecting the
18 * session.
17 * @constructor 19 * @constructor
18 */ 20 */
19 remoting.WindowFrame = function(titleBar) { 21 remoting.WindowFrame = function(titleBar, disconnectCallback) {
20 /** @private {remoting.DesktopConnectedView} */ 22 /** @private {remoting.DesktopConnectedView} */
21 this.desktopConnectedView_ = null; 23 this.desktopConnectedView_ = null;
22 24
23 /** @private {HTMLElement} */ 25 /** @private {HTMLElement} */
24 this.titleBar_ = titleBar; 26 this.titleBar_ = titleBar;
25 27
26 /** @private {HTMLElement} */ 28 /** @private {HTMLElement} */
27 this.title_ = /** @type {HTMLElement} */ 29 this.title_ = /** @type {HTMLElement} */
28 (titleBar.querySelector('.window-title')); 30 (titleBar.querySelector('.window-title'));
29 base.debug.assert(this.title_ != null); 31 base.debug.assert(this.title_ != null);
(...skipping 12 matching lines...) Expand all
42 44
43 /** @private {HTMLElement} */ 45 /** @private {HTMLElement} */
44 this.optionsMenuList_ = /** @type {HTMLElement} */ 46 this.optionsMenuList_ = /** @type {HTMLElement} */
45 (optionsButton.querySelector('.window-options-menu')); 47 (optionsButton.querySelector('.window-options-menu'));
46 base.debug.assert(this.optionsMenuList_ != null); 48 base.debug.assert(this.optionsMenuList_ != null);
47 49
48 /** 50 /**
49 * @type {Array<{cls:string, fn: function()}>} 51 * @type {Array<{cls:string, fn: function()}>}
50 */ 52 */
51 var handlers = [ 53 var handlers = [
52 { cls: 'window-disconnect', fn: this.disconnectSession_.bind(this) }, 54 { cls: 'window-disconnect', fn: disconnectCallback },
53 { cls: 'window-maximize-restore', 55 { cls: 'window-maximize-restore',
54 fn: this.maximizeOrRestoreWindow_.bind(this) }, 56 fn: this.maximizeOrRestoreWindow_.bind(this) },
55 { cls: 'window-minimize', fn: this.minimizeWindow_.bind(this) }, 57 { cls: 'window-minimize', fn: this.minimizeWindow_.bind(this) },
56 { cls: 'window-close', fn: remoting.app.quit.bind(remoting.app) }, 58 { cls: 'window-close', fn: remoting.app.quit.bind(remoting.app) },
57 { cls: 'window-controls-stub', fn: this.toggleWindowControls_.bind(this) } 59 { cls: 'window-controls-stub', fn: this.toggleWindowControls_.bind(this) }
58 ]; 60 ];
59 for (var i = 0; i < handlers.length; ++i) { 61 for (var i = 0; i < handlers.length; ++i) {
60 var element = titleBar.querySelector('.' + handlers[i].cls); 62 var element = titleBar.querySelector('.' + handlers[i].cls);
61 base.debug.assert(element != null); 63 base.debug.assert(element != null);
62 element.addEventListener('click', handlers[i].fn, false); 64 element.addEventListener('click', handlers[i].fn, false);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return { 122 return {
121 'height': window.innerHeight - titleHeight - 2 * kBorderWidth, 123 'height': window.innerHeight - titleHeight - 2 * kBorderWidth,
122 'width': window.innerWidth - 2 * kBorderWidth 124 'width': window.innerWidth - 2 * kBorderWidth
123 }; 125 };
124 } 126 }
125 }; 127 };
126 128
127 /** 129 /**
128 * @private 130 * @private
129 */ 131 */
130 remoting.WindowFrame.prototype.disconnectSession_ = function() {
131 remoting.app.disconnect();
132 };
133
134 /**
135 * @private
136 */
137 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() { 132 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() {
138 /** @type {boolean} */ 133 /** @type {boolean} */
139 var restore = 134 var restore =
140 chrome.app.window.current().isFullscreen() || 135 chrome.app.window.current().isFullscreen() ||
141 chrome.app.window.current().isMaximized(); 136 chrome.app.window.current().isMaximized();
142 if (restore) { 137 if (restore) {
143 chrome.app.window.current().restore(); 138 chrome.app.window.current().restore();
144 } else { 139 } else {
145 chrome.app.window.current().maximize(); 140 chrome.app.window.current().maximize();
146 } 141 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 var hidePreview = function() { 214 var hidePreview = function() {
220 target.classList.remove('preview'); 215 target.classList.remove('preview');
221 }; 216 };
222 target.classList.add('preview'); 217 target.classList.add('preview');
223 window.setTimeout(hidePreview, kPreviewTimeoutMs); 218 window.setTimeout(hidePreview, kPreviewTimeoutMs);
224 }; 219 };
225 220
226 221
227 /** @type {remoting.WindowFrame} */ 222 /** @type {remoting.WindowFrame} */
228 remoting.windowFrame = null; 223 remoting.windowFrame = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/toolbar.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698