| Index: remoting/webapp/window_frame.js
|
| diff --git a/remoting/webapp/window_frame.js b/remoting/webapp/window_frame.js
|
| index 6bdf3fb752ca70f48151615d4e28b89db79f8323..ce62f6c056ddea4dd2a30276772727ae1a47d7ef 100644
|
| --- a/remoting/webapp/window_frame.js
|
| +++ b/remoting/webapp/window_frame.js
|
| @@ -18,10 +18,10 @@ var remoting = remoting || {};
|
| */
|
| remoting.WindowFrame = function(titleBar) {
|
| /**
|
| - * @type {boolean}
|
| + * @type {remoting.ClientSession}
|
| * @private
|
| */
|
| - this.isConnected_ = false;
|
| + this.clientSession_ = null;
|
|
|
| /**
|
| * @type {HTMLElement}
|
| @@ -38,6 +38,25 @@ remoting.WindowFrame = function(titleBar) {
|
| base.debug.assert(this.hoverTarget_ != null);
|
|
|
| /**
|
| + * @type {remoting.OptionsMenu}
|
| + * @private
|
| + */
|
| + this.optionsMenu_ = new remoting.OptionsMenu(
|
| + titleBar.querySelector('.menu-send-ctrl-alt-del'),
|
| + titleBar.querySelector('.menu-send-print-screen'),
|
| + titleBar.querySelector('.menu-resize-to-client'),
|
| + titleBar.querySelector('.menu-shrink-to-fit'),
|
| + null);
|
| +
|
| + /**
|
| + * @type {HTMLElement}
|
| + * @private
|
| + */
|
| + this.title_ = /** @type {HTMLElement} */
|
| + (titleBar.querySelector('.window-title'));
|
| + base.debug.assert(this.title_ != null);
|
| +
|
| + /**
|
| * @type {HTMLElement}
|
| * @private
|
| */
|
| @@ -46,6 +65,28 @@ remoting.WindowFrame = function(titleBar) {
|
| base.debug.assert(this.maximizeRestoreControl_ != null);
|
|
|
| /**
|
| + * @type {HTMLElement}
|
| + * @private
|
| + */
|
| + this.resizeToClientMenuEntry_ = /** @type {HTMLElement} */
|
| + (titleBar.querySelector('.menu-resize-to-client'));
|
| + base.debug.assert(this.resizeToClientMenuEntry_ != null);
|
| +
|
| + /**
|
| + * @type {HTMLElement}
|
| + * @private
|
| + */
|
| + this.shrinkToFitMenuEntry_ = /** @type {HTMLElement} */
|
| + (titleBar.querySelector('.menu-shrink-to-fit'));
|
| + base.debug.assert(this.shrinkToFitMenuEntry_ != null);
|
| +
|
| + var optionsButton = titleBar.querySelector('.window-options');
|
| + base.debug.assert(optionsButton != null);
|
| + this.optionMenuButton_ = new remoting.MenuButton(
|
| + optionsButton,
|
| + this.optionsMenu_.onShow.bind(this.optionsMenu_));
|
| +
|
| + /**
|
| * @type {Array.<{cls:string, fn: function()}>}
|
| */
|
| var handlers = [
|
| @@ -73,14 +114,23 @@ remoting.WindowFrame = function(titleBar) {
|
| };
|
|
|
| /**
|
| - * @param {boolean} isConnected True if there is a connection active.
|
| + * @param {remoting.ClientSession} clientSession The client session, or null if
|
| + * there is no connection.
|
| */
|
| -remoting.WindowFrame.prototype.setConnected = function(isConnected) {
|
| - this.isConnected_ = isConnected;
|
| - if (this.isConnected_) {
|
| +remoting.WindowFrame.prototype.setClientSession = function(clientSession) {
|
| + this.optionsMenu_.setClientSession(clientSession);
|
| + this.clientSession_ = clientSession;
|
| + var windowTitle = document.head.querySelector('title');
|
| + if (this.clientSession_) {
|
| document.body.classList.add('connected');
|
| + this.title_.innerText = clientSession.getHostDisplayName();
|
| + windowTitle.innerText = clientSession.getHostDisplayName() + ' - ' +
|
| + chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME');
|
| } else {
|
| document.body.classList.remove('connected');
|
| + this.title_.innerHTML = ' ';
|
| + windowTitle.innerText =
|
| + chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME');
|
| }
|
| this.updateMaximizeOrRestoreIconTitle_();
|
| };
|
| @@ -131,7 +181,7 @@ remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() {
|
| // being maximized, then the second restore has no effect.
|
| chrome.app.window.current().restore();
|
| chrome.app.window.current().restore();
|
| - } else if (this.isConnected_) {
|
| + } else if (this.clientSession_) {
|
| chrome.app.window.current().fullscreen();
|
| } else {
|
| chrome.app.window.current().maximize();
|
| @@ -165,7 +215,7 @@ remoting.WindowFrame.prototype.updateMaximizeOrRestoreIconTitle_ = function() {
|
| tag = /*i18n-content*/'EXIT_FULL_SCREEN';
|
| } else if (chrome.app.window.current().isMaximized()) {
|
| tag = /*i18n-content*/'RESTORE_WINDOW';
|
| - } else if (this.isConnected_) {
|
| + } else if (this.clientSession_) {
|
| tag = /*i18n-content*/'FULL_SCREEN';
|
| } else {
|
| tag = /*i18n-content*/'MAXIMIZE_WINDOW';
|
| @@ -174,4 +224,4 @@ remoting.WindowFrame.prototype.updateMaximizeOrRestoreIconTitle_ = function() {
|
| };
|
|
|
| /** @type {remoting.WindowFrame} */
|
| -remoting.windowFrame = null;
|
| +remoting.windowFrame = null;
|
|
|