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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 } else if (newState == remoting.ClientSession.State.CONNECTING) { | 190 } else if (newState == remoting.ClientSession.State.CONNECTING) { |
191 console.log('Connecting as ' + remoting.oauth2.getCachedEmail()); | 191 console.log('Connecting as ' + remoting.oauth2.getCachedEmail()); |
192 | 192 |
193 } else if (newState == remoting.ClientSession.State.INITIALIZING) { | 193 } else if (newState == remoting.ClientSession.State.INITIALIZING) { |
194 console.log('Initializing connection'); | 194 console.log('Initializing connection'); |
195 | 195 |
196 } else if (newState == remoting.ClientSession.State.CONNECTED) { | 196 } else if (newState == remoting.ClientSession.State.CONNECTED) { |
197 if (remoting.clientSession) { | 197 if (remoting.clientSession) { |
198 clearPin = true; | 198 clearPin = true; |
| 199 setConnectionInterruptedButtonsText_(); |
199 remoting.setMode(remoting.AppMode.IN_SESSION); | 200 remoting.setMode(remoting.AppMode.IN_SESSION); |
200 remoting.toolbar.center(); | 201 remoting.toolbar.center(); |
201 remoting.toolbar.preview(); | 202 remoting.toolbar.preview(); |
202 updateStatistics_(); | 203 updateStatistics_(); |
203 } | 204 } |
204 | 205 |
205 } else if (newState == remoting.ClientSession.State.CLOSED) { | 206 } else if (newState == remoting.ClientSession.State.CLOSED) { |
206 if (oldState == remoting.ClientSession.State.CONNECTED) { | 207 if (oldState == remoting.ClientSession.State.CONNECTED) { |
207 remoting.clientSession.removePlugin(); | 208 remoting.clientSession.removePlugin(); |
208 remoting.clientSession = null; | 209 remoting.clientSession = null; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 remoting.clientSession = null; | 324 remoting.clientSession = null; |
324 } | 325 } |
325 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { | 326 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { |
326 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 327 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
327 } else { | 328 } else { |
328 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 329 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
329 } | 330 } |
330 } | 331 } |
331 | 332 |
332 /** | 333 /** |
| 334 * Set the text on the buttons shown under the error message so that they are |
| 335 * easy to understand in the case where a successful connection failed, as |
| 336 * opposed to the case where a connection never succeeded. |
| 337 */ |
| 338 function setConnectionInterruptedButtonsText_() { |
| 339 var button1 = document.getElementById('client-reconnect-button'); |
| 340 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); |
| 341 button1.removeAttribute('autofocus'); |
| 342 var button2 = document.getElementById('client-finished-me2me-button'); |
| 343 l10n.localizeElementFromTag(button2, /*i18n-content*/'OK'); |
| 344 button2.setAttribute('autofocus', 'autofocus'); |
| 345 } |
| 346 |
| 347 /** |
333 * Parse the response from the server to a request to resolve a support id. | 348 * Parse the response from the server to a request to resolve a support id. |
334 * | 349 * |
335 * @param {XMLHttpRequest} xhr The XMLHttpRequest object. | 350 * @param {XMLHttpRequest} xhr The XMLHttpRequest object. |
336 * @return {void} Nothing. | 351 * @return {void} Nothing. |
337 */ | 352 */ |
338 function parseServerResponse_(xhr) { | 353 function parseServerResponse_(xhr) { |
339 remoting.supportHostsXhr_ = null; | 354 remoting.supportHostsXhr_ = null; |
340 console.log('parseServerResponse: xhr = ' + xhr); | 355 console.log('parseServerResponse: xhr = ' + xhr); |
341 if (xhr.status == 200) { | 356 if (xhr.status == 200) { |
342 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ | 357 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 pin, 'spake2_hmac,spake2_plain', remoting.hostId, | 506 pin, 'spake2_hmac,spake2_plain', remoting.hostId, |
492 /** @type {string} */ (remoting.oauth2.getCachedEmail()), | 507 /** @type {string} */ (remoting.oauth2.getCachedEmail()), |
493 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); | 508 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); |
494 remoting.clientSession.createPluginAndConnect( | 509 remoting.clientSession.createPluginAndConnect( |
495 document.getElementById('session-mode'), | 510 document.getElementById('session-mode'), |
496 token); | 511 token); |
497 } else { | 512 } else { |
498 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); | 513 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); |
499 } | 514 } |
500 } | 515 } |
OLD | NEW |