| 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 * This class implements the functionality that is specific to desktop | 7 * This class implements the functionality that is specific to desktop |
| 8 * remoting ("Chromoting" or CRD). | 8 * remoting ("Chromoting" or CRD). |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 ); | 91 ); |
| 92 | 92 |
| 93 } else { | 93 } else { |
| 94 remoting.fullscreen = new remoting.FullscreenAppsV1(); | 94 remoting.fullscreen = new remoting.FullscreenAppsV1(); |
| 95 remoting.toolbar = new remoting.Toolbar( | 95 remoting.toolbar = new remoting.Toolbar( |
| 96 document.getElementById('session-toolbar')); | 96 document.getElementById('session-toolbar')); |
| 97 remoting.optionsMenu = remoting.toolbar.createOptionsMenu(); | 97 remoting.optionsMenu = remoting.toolbar.createOptionsMenu(); |
| 98 | 98 |
| 99 window.addEventListener('beforeunload', remoting.promptClose, false); | 99 window.addEventListener('beforeunload', remoting.promptClose, false); |
| 100 window.addEventListener('unload', remoting.disconnect, false); | 100 window.addEventListener('unload', |
| 101 remoting.app.disconnect.bind(remoting.app), false); |
| 101 } | 102 } |
| 102 | 103 |
| 103 // When a window goes full-screen, a resize event is triggered, but the | |
| 104 // Fullscreen.isActive call is not guaranteed to return true until the | |
| 105 // full-screen event is triggered. In apps v2, the size of the window's | |
| 106 // client area is calculated differently in full-screen mode, so register | |
| 107 // for both events. | |
| 108 window.addEventListener('resize', remoting.onResize, false); | |
| 109 remoting.fullscreen.addListener(remoting.onResize); | |
| 110 | |
| 111 remoting.initHostlist_(); | 104 remoting.initHostlist_(); |
| 112 | 105 |
| 113 var homeFeedback = new remoting.MenuButton( | 106 var homeFeedback = new remoting.MenuButton( |
| 114 document.getElementById('help-feedback-main')); | 107 document.getElementById('help-feedback-main')); |
| 115 var toolbarFeedback = new remoting.MenuButton( | 108 var toolbarFeedback = new remoting.MenuButton( |
| 116 document.getElementById('help-feedback-toolbar')); | 109 document.getElementById('help-feedback-toolbar')); |
| 117 remoting.manageHelpAndFeedback( | 110 remoting.manageHelpAndFeedback( |
| 118 document.getElementById('title-bar')); | 111 document.getElementById('title-bar')); |
| 119 remoting.manageHelpAndFeedback( | 112 remoting.manageHelpAndFeedback( |
| 120 document.getElementById('help-feedback-toolbar')); | 113 document.getElementById('help-feedback-toolbar')); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 clientSession.requestPairing(clientName, onPairingComplete); | 219 clientSession.requestPairing(clientName, onPairingComplete); |
| 227 } | 220 } |
| 228 }; | 221 }; |
| 229 | 222 |
| 230 /** | 223 /** |
| 231 * Called when the current session has been disconnected. | 224 * Called when the current session has been disconnected. |
| 232 * | 225 * |
| 233 * @return {void} Nothing. | 226 * @return {void} Nothing. |
| 234 */ | 227 */ |
| 235 remoting.DesktopRemoting.prototype.handleDisconnected = function() { | 228 remoting.DesktopRemoting.prototype.handleDisconnected = function() { |
| 229 if (remoting.desktopConnectedView.getMode() == |
| 230 remoting.DesktopConnectedView.Mode.IT2ME) { |
| 231 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
| 232 } else { |
| 233 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); |
| 234 } |
| 236 }; | 235 }; |
| 237 | 236 |
| 238 /** | 237 /** |
| 239 * Called when the current session's connection has failed. | 238 * Called when the current session's connection has failed. |
| 240 * | 239 * |
| 241 * @param {remoting.SessionConnector} connector | 240 * @param {remoting.SessionConnector} connector |
| 242 * @param {remoting.Error} error | 241 * @param {remoting.Error} error |
| 243 * @return {void} Nothing. | 242 * @return {void} Nothing. |
| 244 */ | 243 */ |
| 245 remoting.DesktopRemoting.prototype.handleConnectionFailed = function( | 244 remoting.DesktopRemoting.prototype.handleConnectionFailed = function( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); | 310 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); |
| 312 | 311 |
| 313 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() | 312 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() |
| 314 : this.app_.getSessionConnector().getConnectionMode(); | 313 : this.app_.getSessionConnector().getConnectionMode(); |
| 315 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { | 314 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { |
| 316 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 315 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
| 317 } else { | 316 } else { |
| 318 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 317 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
| 319 } | 318 } |
| 320 }; | 319 }; |
| OLD | NEW |