| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 * a host-specific one-shot event handler for the form submission. | 238 * a host-specific one-shot event handler for the form submission. |
| 239 * | 239 * |
| 240 * @param {remoting.Host} host The Me2Me host to which to connect. | 240 * @param {remoting.Host} host The Me2Me host to which to connect. |
| 241 * @return {void} Nothing. | 241 * @return {void} Nothing. |
| 242 */ | 242 */ |
| 243 remoting.connectMe2MeHostVersionAcknowledged_ = function(host) { | 243 remoting.connectMe2MeHostVersionAcknowledged_ = function(host) { |
| 244 remoting.connector = new remoting.SessionConnector( | 244 remoting.connector = new remoting.SessionConnector( |
| 245 document.getElementById('session-mode'), | 245 document.getElementById('session-mode'), |
| 246 remoting.onConnected, | 246 remoting.onConnected, |
| 247 showConnectError_); | 247 showConnectError_); |
| 248 /** @type {Element} */ | 248 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
| 249 var pinForm = document.getElementById('pin-form'); | 249 |
| 250 /** @param {Event} event */ | 250 /** @param {function(string):void} onPinFetched */ |
| 251 var onSubmit = function(event) { | 251 var requestPin = function(onPinFetched) { |
| 252 pinForm.removeEventListener('submit', onSubmit, false); | 252 /** @type {Element} */ |
| 253 var pin = document.getElementById('pin-entry').value; | 253 var pinForm = document.getElementById('pin-form'); |
| 254 remoting.connector.connectMe2Me(host, pin); | 254 /** @param {Event} event */ |
| 255 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 255 var onSubmit = function(event) { |
| 256 event.preventDefault(); | 256 event.preventDefault(); |
| 257 pinForm.removeEventListener('submit', onSubmit, false); |
| 258 var pin = document.getElementById('pin-entry').value; |
| 259 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
| 260 onPinFetched(pin); |
| 261 }; |
| 262 pinForm.addEventListener('submit', onSubmit, false); |
| 263 |
| 264 var message = document.getElementById('pin-message'); |
| 265 l10n.localizeElement(message, host.hostName); |
| 266 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); |
| 257 }; | 267 }; |
| 258 pinForm.addEventListener('submit', onSubmit, false); | 268 remoting.connector.connectMe2Me(host, requestPin); |
| 259 | |
| 260 var message = document.getElementById('pin-message'); | |
| 261 l10n.localizeElement(message, host.hostName); | |
| 262 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); | |
| 263 }; | 269 }; |
| 264 | 270 |
| 265 /** @param {remoting.ClientSession} clientSession */ | 271 /** @param {remoting.ClientSession} clientSession */ |
| 266 remoting.onConnected = function(clientSession) { | 272 remoting.onConnected = function(clientSession) { |
| 267 remoting.connector = null; | 273 remoting.connector = null; |
| 268 remoting.clientSession = clientSession; | 274 remoting.clientSession = clientSession; |
| 269 remoting.clientSession.setOnStateChange(onClientStateChange_); | 275 remoting.clientSession.setOnStateChange(onClientStateChange_); |
| 270 setConnectionInterruptedButtonsText_(); | 276 setConnectionInterruptedButtonsText_(); |
| 271 remoting.setMode(remoting.AppMode.IN_SESSION); | 277 remoting.setMode(remoting.AppMode.IN_SESSION); |
| 272 remoting.toolbar.center(); | 278 remoting.toolbar.center(); |
| 273 remoting.toolbar.preview(); | 279 remoting.toolbar.preview(); |
| 274 remoting.clipboard.startSession(); | 280 remoting.clipboard.startSession(); |
| 275 updateStatistics_(); | 281 updateStatistics_(); |
| 276 }; | 282 }; |
| OLD | NEW |