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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 /** | 105 /** |
106 * @private | 106 * @private |
107 */ | 107 */ |
108 remoting.WindowFrame.prototype.disconnectSession_ = function() { | 108 remoting.WindowFrame.prototype.disconnectSession_ = function() { |
109 // When the user disconnects, exit full-screen mode. This should not be | 109 // When the user disconnects, exit full-screen mode. This should not be |
110 // necessary, as we do the same thing in client_session.js when the plugin | 110 // necessary, as we do the same thing in client_session.js when the plugin |
111 // is removed. However, there seems to be a bug in chrome.AppWindow.restore | 111 // is removed. However, there seems to be a bug in chrome.AppWindow.restore |
112 // that causes it to get stuck in full-screen mode without this. | 112 // that causes it to get stuck in full-screen mode without this. |
113 if (chrome.app.window.current().isFullscreen()) { | 113 if (chrome.app.window.current().isFullscreen()) { |
114 chrome.app.window.current().restore(); | 114 chrome.app.window.current().restore(); |
115 chrome.app.window.current().restore(); | |
116 } | 115 } |
117 remoting.disconnect(); | 116 remoting.disconnect(); |
118 }; | 117 }; |
119 | 118 |
120 /** | 119 /** |
121 * @private | 120 * @private |
122 */ | 121 */ |
123 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() { | 122 remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() { |
124 /** @type {boolean} */ | 123 /** @type {boolean} */ |
125 var restore = | 124 var restore = |
126 chrome.app.window.current().isFullscreen() || | 125 chrome.app.window.current().isFullscreen() || |
127 chrome.app.window.current().isMaximized(); | 126 chrome.app.window.current().isMaximized(); |
128 if (restore) { | 127 if (restore) { |
129 // Restore twice: once to exit full-screen and once to exit maximized. | 128 // Restore twice: once to exit full-screen and once to exit maximized. |
130 // If the app is not full-screen, or went full-screen without first | 129 // If the app is not full-screen, or went full-screen without first |
131 // being maximized, then the second restore has no effect. | 130 // being maximized, then the second restore has no effect. |
132 chrome.app.window.current().restore(); | 131 chrome.app.window.current().restore(); |
133 chrome.app.window.current().restore(); | |
134 } else if (this.isConnected_) { | 132 } else if (this.isConnected_) { |
135 chrome.app.window.current().fullscreen(); | 133 chrome.app.window.current().fullscreen(); |
136 } else { | 134 } else { |
137 chrome.app.window.current().maximize(); | 135 chrome.app.window.current().maximize(); |
138 } | 136 } |
139 }; | 137 }; |
140 | 138 |
141 /** | 139 /** |
142 * @private | 140 * @private |
143 */ | 141 */ |
(...skipping 24 matching lines...) Expand all Loading... |
168 } else if (this.isConnected_) { | 166 } else if (this.isConnected_) { |
169 tag = /*i18n-content*/'FULL_SCREEN'; | 167 tag = /*i18n-content*/'FULL_SCREEN'; |
170 } else { | 168 } else { |
171 tag = /*i18n-content*/'MAXIMIZE_WINDOW'; | 169 tag = /*i18n-content*/'MAXIMIZE_WINDOW'; |
172 } | 170 } |
173 this.maximizeRestoreControl_.title = l10n.getTranslationOrError(tag); | 171 this.maximizeRestoreControl_.title = l10n.getTranslationOrError(tag); |
174 }; | 172 }; |
175 | 173 |
176 /** @type {remoting.WindowFrame} */ | 174 /** @type {remoting.WindowFrame} */ |
177 remoting.windowFrame = null; | 175 remoting.windowFrame = null; |
OLD | NEW |