OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * Functions related to the 'client screen' for Chromoting. | 7 * Functions related to the 'client screen' for Chromoting. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 function showConnectError_(errorTag) { | 130 function showConnectError_(errorTag) { |
131 console.error('Connection failed: ' + errorTag); | 131 console.error('Connection failed: ' + errorTag); |
132 var errorDiv = document.getElementById('connect-error-message'); | 132 var errorDiv = document.getElementById('connect-error-message'); |
133 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); | 133 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); |
134 remoting.accessCode = ''; | 134 remoting.accessCode = ''; |
135 var mode = remoting.clientSession ? remoting.clientSession.getMode() | 135 var mode = remoting.clientSession ? remoting.clientSession.getMode() |
136 : remoting.connector.getConnectionMode(); | 136 : remoting.connector.getConnectionMode(); |
137 if (mode == remoting.ClientSession.Mode.IT2ME) { | 137 if (mode == remoting.ClientSession.Mode.IT2ME) { |
138 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 138 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
139 remoting.hangoutSessionEvents.raiseEvent( | 139 remoting.hangoutSessionEvents.raiseEvent( |
140 remoting.hangoutSessionEvents.sessionStateChanged, | 140 remoting.hangoutSessionEvents.sessionStateChanged, |
141 remoting.ClientSession.State.FAILED | 141 remoting.ClientSession.State.FAILED |
142 ); | 142 ); |
143 } else { | 143 } else { |
144 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 144 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 /** | 148 /** |
149 * Set the text on the buttons shown under the error message so that they are | 149 * Set the text on the buttons shown under the error message so that they are |
150 * easy to understand in the case where a successful connection failed, as | 150 * easy to understand in the case where a successful connection failed, as |
151 * opposed to the case where a connection never succeeded. | 151 * opposed to the case where a connection never succeeded. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 remoting.clientSession = clientSession; | 318 remoting.clientSession = clientSession; |
319 remoting.clientSession.addEventListener('stateChanged', onClientStateChange_); | 319 remoting.clientSession.addEventListener('stateChanged', onClientStateChange_); |
320 setConnectionInterruptedButtonsText_(); | 320 setConnectionInterruptedButtonsText_(); |
321 document.getElementById('access-code-entry').value = ''; | 321 document.getElementById('access-code-entry').value = ''; |
322 remoting.setMode(remoting.AppMode.IN_SESSION); | 322 remoting.setMode(remoting.AppMode.IN_SESSION); |
323 remoting.toolbar.center(); | 323 remoting.toolbar.center(); |
324 remoting.toolbar.preview(); | 324 remoting.toolbar.preview(); |
325 remoting.clipboard.startSession(); | 325 remoting.clipboard.startSession(); |
326 updateStatistics_(); | 326 updateStatistics_(); |
327 remoting.hangoutSessionEvents.raiseEvent( | 327 remoting.hangoutSessionEvents.raiseEvent( |
328 remoting.hangoutSessionEvents.sessionStateChanged, | 328 remoting.hangoutSessionEvents.sessionStateChanged, |
329 remoting.ClientSession.State.CONNECTED | 329 remoting.ClientSession.State.CONNECTED |
330 ); | 330 ); |
331 if (remoting.connector.pairingRequested) { | 331 if (remoting.connector.pairingRequested) { |
332 /** | 332 /** |
333 * @param {string} clientId | 333 * @param {string} clientId |
334 * @param {string} sharedSecret | 334 * @param {string} sharedSecret |
335 */ | 335 */ |
336 var onPairingComplete = function(clientId, sharedSecret) { | 336 var onPairingComplete = function(clientId, sharedSecret) { |
337 var pairingInfo = { | 337 var pairingInfo = { |
338 pairingInfo: { | 338 pairingInfo: { |
339 clientId: clientId, | 339 clientId: clientId, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 * Create a session connector if one doesn't already exist. | 378 * Create a session connector if one doesn't already exist. |
379 */ | 379 */ |
380 remoting.ensureSessionConnector_ = function() { | 380 remoting.ensureSessionConnector_ = function() { |
381 if (!remoting.connector) { | 381 if (!remoting.connector) { |
382 remoting.connector = new remoting.SessionConnector( | 382 remoting.connector = new remoting.SessionConnector( |
383 document.getElementById('video-container'), | 383 document.getElementById('video-container'), |
384 remoting.onConnected, | 384 remoting.onConnected, |
385 showConnectError_, remoting.onExtensionMessage); | 385 showConnectError_, remoting.onExtensionMessage); |
386 } | 386 } |
387 }; | 387 }; |
OLD | NEW |