| 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 remoting.hangoutSessionEvents.raiseEvent( |
| 233 remoting.hangoutSessionEvents.sessionStateChanged, |
| 234 remoting.ClientSession.State.CLOSED); |
| 235 } else { |
| 236 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); |
| 237 } |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 /** | 240 /** |
| 239 * Called when the current session's connection has failed. | 241 * Called when the current session's connection has failed. |
| 240 * | 242 * |
| 241 * @param {remoting.SessionConnector} connector | 243 * @param {remoting.SessionConnector} connector |
| 242 * @param {remoting.Error} error | 244 * @param {remoting.Error} error |
| 243 * @return {void} Nothing. | 245 * @return {void} Nothing. |
| 244 */ | 246 */ |
| 245 remoting.DesktopRemoting.prototype.handleConnectionFailed = function( | 247 remoting.DesktopRemoting.prototype.handleConnectionFailed = function( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { | 317 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { |
| 316 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 318 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
| 317 remoting.hangoutSessionEvents.raiseEvent( | 319 remoting.hangoutSessionEvents.raiseEvent( |
| 318 remoting.hangoutSessionEvents.sessionStateChanged, | 320 remoting.hangoutSessionEvents.sessionStateChanged, |
| 319 remoting.ClientSession.State.FAILED | 321 remoting.ClientSession.State.FAILED |
| 320 ); | 322 ); |
| 321 } else { | 323 } else { |
| 322 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 324 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
| 323 } | 325 } |
| 324 }; | 326 }; |
| OLD | NEW |