| 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'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 /** | 32 /** |
| 33 * @type {remoting.OptionsMenu} | 33 * @type {remoting.OptionsMenu} |
| 34 * @private | 34 * @private |
| 35 */ | 35 */ |
| 36 this.optionsMenu_ = new remoting.OptionsMenu( | 36 this.optionsMenu_ = new remoting.OptionsMenu( |
| 37 titleBar.querySelector('.menu-send-ctrl-alt-del'), | 37 titleBar.querySelector('.menu-send-ctrl-alt-del'), |
| 38 titleBar.querySelector('.menu-send-print-screen'), | 38 titleBar.querySelector('.menu-send-print-screen'), |
| 39 titleBar.querySelector('.menu-resize-to-client'), | 39 titleBar.querySelector('.menu-resize-to-client'), |
| 40 titleBar.querySelector('.menu-shrink-to-fit'), | 40 titleBar.querySelector('.menu-shrink-to-fit'), |
| 41 titleBar.querySelector('.menu-new-connection'), | 41 titleBar.querySelector('.menu-new-connection'), |
| 42 null, | 42 titleBar.querySelector('.window-fullscreen'), |
| 43 titleBar.querySelector('.menu-start-stop-recording')); | 43 titleBar.querySelector('.menu-start-stop-recording')); |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @type {HTMLElement} | 46 * @type {HTMLElement} |
| 47 * @private | 47 * @private |
| 48 */ | 48 */ |
| 49 this.title_ = /** @type {HTMLElement} */ | 49 this.title_ = /** @type {HTMLElement} */ |
| 50 (titleBar.querySelector('.window-title')); | 50 (titleBar.querySelector('.window-title')); |
| 51 base.debug.assert(this.title_ != null); | 51 base.debug.assert(this.title_ != null); |
| 52 | 52 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * @private | 157 * @private |
| 158 */ | 158 */ |
| 159 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() { | 159 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() { |
| 160 /** @type {boolean} */ | 160 /** @type {boolean} */ |
| 161 var restore = | 161 var restore = |
| 162 chrome.app.window.current().isFullscreen() || | 162 chrome.app.window.current().isFullscreen() || |
| 163 chrome.app.window.current().isMaximized(); | 163 chrome.app.window.current().isMaximized(); |
| 164 if (restore) { | 164 if (restore) { |
| 165 // Restore twice: once to exit full-screen and once to exit maximized. | |
| 166 // If the app is not full-screen, or went full-screen without first | |
| 167 // being maximized, then the second restore has no effect. | |
| 168 chrome.app.window.current().restore(); | 165 chrome.app.window.current().restore(); |
| 169 chrome.app.window.current().restore(); | |
| 170 } else if (this.clientSession_) { | |
| 171 chrome.app.window.current().fullscreen(); | |
| 172 } else { | 166 } else { |
| 173 chrome.app.window.current().maximize(); | 167 chrome.app.window.current().maximize(); |
| 174 } | 168 } |
| 175 }; | 169 }; |
| 176 | 170 |
| 177 /** | 171 /** |
| 178 * @private | 172 * @private |
| 179 */ | 173 */ |
| 180 remoting.WindowFrame.prototype.minimizeWindow_ = function() { | 174 remoting.WindowFrame.prototype.minimizeWindow_ = function() { |
| 181 chrome.app.window.current().minimize(); | 175 chrome.app.window.current().minimize(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 195 * @private | 189 * @private |
| 196 */ | 190 */ |
| 197 remoting.WindowFrame.prototype.handleWindowStateChange_ = function() { | 191 remoting.WindowFrame.prototype.handleWindowStateChange_ = function() { |
| 198 // Set the title for the maximize/restore/full-screen button | 192 // Set the title for the maximize/restore/full-screen button |
| 199 /** @type {string} */ | 193 /** @type {string} */ |
| 200 var tag = ''; | 194 var tag = ''; |
| 201 if (chrome.app.window.current().isFullscreen()) { | 195 if (chrome.app.window.current().isFullscreen()) { |
| 202 tag = /*i18n-content*/'EXIT_FULL_SCREEN'; | 196 tag = /*i18n-content*/'EXIT_FULL_SCREEN'; |
| 203 } else if (chrome.app.window.current().isMaximized()) { | 197 } else if (chrome.app.window.current().isMaximized()) { |
| 204 tag = /*i18n-content*/'RESTORE_WINDOW'; | 198 tag = /*i18n-content*/'RESTORE_WINDOW'; |
| 205 } else if (this.clientSession_) { | |
| 206 tag = /*i18n-content*/'FULL_SCREEN'; | |
| 207 } else { | 199 } else { |
| 208 tag = /*i18n-content*/'MAXIMIZE_WINDOW'; | 200 tag = /*i18n-content*/'MAXIMIZE_WINDOW'; |
| 209 } | 201 } |
| 210 this.maximizeRestoreControl_.title = l10n.getTranslationOrError(tag); | 202 this.maximizeRestoreControl_.title = l10n.getTranslationOrError(tag); |
| 211 | 203 |
| 212 // Ensure that the options menu aligns correctly for the side of the window | 204 // Ensure that the options menu aligns correctly for the side of the window |
| 213 // it occupies. | 205 // it occupies. |
| 214 if (chrome.app.window.current().isFullscreen()) { | 206 if (chrome.app.window.current().isFullscreen()) { |
| 215 this.optionsMenuList_.classList.add('right-align'); | 207 this.optionsMenuList_.classList.add('right-align'); |
| 216 } else { | 208 } else { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 var hidePreview = function() { | 241 var hidePreview = function() { |
| 250 target.classList.remove('preview'); | 242 target.classList.remove('preview'); |
| 251 }; | 243 }; |
| 252 target.classList.add('preview'); | 244 target.classList.add('preview'); |
| 253 window.setTimeout(hidePreview, kPreviewTimeoutMs); | 245 window.setTimeout(hidePreview, kPreviewTimeoutMs); |
| 254 }; | 246 }; |
| 255 | 247 |
| 256 | 248 |
| 257 /** @type {remoting.WindowFrame} */ | 249 /** @type {remoting.WindowFrame} */ |
| 258 remoting.windowFrame = null; | 250 remoting.windowFrame = null; |
| OLD | NEW |