| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Ensure that tool-tips are always correct. | 92 // Ensure that tool-tips are always correct. |
| 93 this.updateMaximizeOrRestoreIconTitle_(); | 93 this.updateMaximizeOrRestoreIconTitle_(); |
| 94 chrome.app.window.current().onMaximized.addListener( | 94 chrome.app.window.current().onMaximized.addListener( |
| 95 this.updateMaximizeOrRestoreIconTitle_.bind(this)); | 95 this.updateMaximizeOrRestoreIconTitle_.bind(this)); |
| 96 chrome.app.window.current().onRestored.addListener( | 96 chrome.app.window.current().onRestored.addListener( |
| 97 this.updateMaximizeOrRestoreIconTitle_.bind(this)); | 97 this.updateMaximizeOrRestoreIconTitle_.bind(this)); |
| 98 chrome.app.window.current().onFullscreened.addListener( | 98 chrome.app.window.current().onFullscreened.addListener( |
| 99 this.updateMaximizeOrRestoreIconTitle_.bind(this)); | 99 this.updateMaximizeOrRestoreIconTitle_.bind(this)); |
| 100 chrome.app.window.current().onFullscreened.addListener( |
| 101 this.showWindowControlsPreview_.bind(this)); |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 /** | 104 /** |
| 103 * @param {remoting.ClientSession} clientSession The client session, or null if | 105 * @param {remoting.ClientSession} clientSession The client session, or null if |
| 104 * there is no connection. | 106 * there is no connection. |
| 105 */ | 107 */ |
| 106 remoting.WindowFrame.prototype.setClientSession = function(clientSession) { | 108 remoting.WindowFrame.prototype.setClientSession = function(clientSession) { |
| 107 this.optionsMenu_.setClientSession(clientSession); | 109 this.optionsMenu_.setClientSession(clientSession); |
| 108 this.clientSession_ = clientSession; | 110 this.clientSession_ = clientSession; |
| 109 var windowTitle = document.head.querySelector('title'); | 111 var windowTitle = document.head.querySelector('title'); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 /** | 222 /** |
| 221 * Callback invoked when the options menu is shown. | 223 * Callback invoked when the options menu is shown. |
| 222 * @private | 224 * @private |
| 223 */ | 225 */ |
| 224 remoting.WindowFrame.prototype.onHideOptionsMenu_ = function() { | 226 remoting.WindowFrame.prototype.onHideOptionsMenu_ = function() { |
| 225 this.hoverTarget_.classList.remove('menu-opened'); | 227 this.hoverTarget_.classList.remove('menu-opened'); |
| 226 }; | 228 }; |
| 227 | 229 |
| 230 /** |
| 231 * Show the window controls for a few seconds |
| 232 * |
| 233 * @private |
| 234 */ |
| 235 remoting.WindowFrame.prototype.showWindowControlsPreview_ = function() { |
| 236 /** |
| 237 * @type {HTMLElement} |
| 238 */ |
| 239 var target = this.hoverTarget_; |
| 240 var kPreviewTimeoutMs = 3000; |
| 241 var hidePreview = function() { |
| 242 target.classList.remove('preview'); |
| 243 }; |
| 244 target.classList.add('preview'); |
| 245 window.setTimeout(hidePreview, kPreviewTimeoutMs); |
| 246 }; |
| 247 |
| 228 | 248 |
| 229 /** @type {remoting.WindowFrame} */ | 249 /** @type {remoting.WindowFrame} */ |
| 230 remoting.windowFrame = null; | 250 remoting.windowFrame = null; |
| OLD | NEW |