Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 | 205 |
| 206 } else if (newState == remoting.ClientSession.State.CONNECTING) { | 206 } else if (newState == remoting.ClientSession.State.CONNECTING) { |
| 207 console.log('Connecting as ' + remoting.oauth2.getCachedEmail()); | 207 console.log('Connecting as ' + remoting.oauth2.getCachedEmail()); |
| 208 | 208 |
| 209 } else if (newState == remoting.ClientSession.State.INITIALIZING) { | 209 } else if (newState == remoting.ClientSession.State.INITIALIZING) { |
| 210 console.log('Initializing connection'); | 210 console.log('Initializing connection'); |
| 211 | 211 |
| 212 } else if (newState == remoting.ClientSession.State.CONNECTED) { | 212 } else if (newState == remoting.ClientSession.State.CONNECTED) { |
| 213 if (remoting.clientSession) { | 213 if (remoting.clientSession) { |
| 214 clearPin = true; | 214 clearPin = true; |
| 215 setConnectionInterruptedButtonsText_(); | |
| 215 remoting.setMode(remoting.AppMode.IN_SESSION); | 216 remoting.setMode(remoting.AppMode.IN_SESSION); |
| 216 remoting.toolbar.center(); | 217 remoting.toolbar.center(); |
| 217 remoting.toolbar.preview(); | 218 remoting.toolbar.preview(); |
| 218 updateStatistics_(); | 219 updateStatistics_(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 } else if (newState == remoting.ClientSession.State.CLOSED) { | 222 } else if (newState == remoting.ClientSession.State.CLOSED) { |
| 222 if (oldState == remoting.ClientSession.State.CONNECTED) { | 223 if (oldState == remoting.ClientSession.State.CONNECTED) { |
| 223 remoting.clientSession.removePlugin(); | 224 remoting.clientSession.removePlugin(); |
| 224 remoting.clientSession = null; | 225 remoting.clientSession = null; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 remoting.clientSession = null; | 341 remoting.clientSession = null; |
| 341 } | 342 } |
| 342 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { | 343 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { |
| 343 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 344 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
| 344 } else { | 345 } else { |
| 345 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 346 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
| 346 } | 347 } |
| 347 } | 348 } |
| 348 | 349 |
| 349 /** | 350 /** |
| 351 * Set the text on the buttons shown under the error message so that they are | |
| 352 * easy to understand in the case where a successful connection failed, as | |
| 353 * opposed to the case where a connection never succeeded. | |
| 354 */ | |
| 355 function setConnectionInterruptedButtonsText_() { | |
| 356 var button1 = document.getElementById('client-reconnect-button'); | |
| 357 l10n.localizeElementFromTag(button1, 'RECONNECT'); | |
|
Jamie
2012/03/22 04:24:05
Please add /*i18n-content*/ to this so that the sc
simonmorris
2012/03/22 17:08:25
Done.
| |
| 358 button1.removeAttribute('autofocus'); | |
| 359 var button2 = document.getElementById('client-finished-me2me-button'); | |
| 360 l10n.localizeElementFromTag(button2, 'OK'); | |
|
Jamie
2012/03/22 04:24:05
Ditto
simonmorris
2012/03/22 17:08:25
Done.
| |
| 361 button2.setAttribute('autofocus', 'autofocus'); | |
| 362 } | |
| 363 | |
| 364 /** | |
| 350 * Parse the response from the server to a request to resolve a support id. | 365 * Parse the response from the server to a request to resolve a support id. |
| 351 * | 366 * |
| 352 * @param {XMLHttpRequest} xhr The XMLHttpRequest object. | 367 * @param {XMLHttpRequest} xhr The XMLHttpRequest object. |
| 353 * @return {void} Nothing. | 368 * @return {void} Nothing. |
| 354 */ | 369 */ |
| 355 function parseServerResponse_(xhr) { | 370 function parseServerResponse_(xhr) { |
| 356 remoting.supportHostsXhr_ = null; | 371 remoting.supportHostsXhr_ = null; |
| 357 console.log('parseServerResponse: xhr = ' + xhr); | 372 console.log('parseServerResponse: xhr = ' + xhr); |
| 358 if (xhr.status == 200) { | 373 if (xhr.status == 200) { |
| 359 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ | 374 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 /** @type {string} */ (remoting.oauth2.getCachedEmail()), | 524 /** @type {string} */ (remoting.oauth2.getCachedEmail()), |
| 510 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); | 525 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); |
| 511 remoting.clientSession.createPluginAndConnect( | 526 remoting.clientSession.createPluginAndConnect( |
| 512 document.getElementById('session-mode'), | 527 document.getElementById('session-mode'), |
| 513 token); | 528 token); |
| 514 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); | 529 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); |
| 515 } else { | 530 } else { |
| 516 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); | 531 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); |
| 517 } | 532 } |
| 518 } | 533 } |
| OLD | NEW |