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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); | 70 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
71 } else { | 71 } else { |
72 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); | 72 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); |
73 } | 73 } |
74 remoting.clientSession.disconnect(remoting.Error.NONE); | 74 remoting.clientSession.disconnect(remoting.Error.NONE); |
75 remoting.clientSession = null; | 75 remoting.clientSession = null; |
76 console.log('Disconnected.'); | 76 console.log('Disconnected.'); |
77 }; | 77 }; |
78 | 78 |
79 /** | 79 /** |
80 * Sends a Ctrl-Alt-Del sequence to the remoting client. | |
81 * | |
82 * @return {void} Nothing. | |
83 */ | |
84 remoting.sendCtrlAltDel = function() { | |
85 if (remoting.clientSession) { | |
86 console.log('Sending Ctrl-Alt-Del.'); | |
87 remoting.clientSession.sendCtrlAltDel(); | |
88 } | |
89 }; | |
90 | |
91 /** | |
92 * Sends a Print Screen keypress to the remoting client. | |
93 * | |
94 * @return {void} Nothing. | |
95 */ | |
96 remoting.sendPrintScreen = function() { | |
97 if (remoting.clientSession) { | |
98 console.log('Sending Print Screen.'); | |
99 remoting.clientSession.sendPrintScreen(); | |
100 } | |
101 }; | |
102 | |
103 /** | |
104 * Callback function called when the state of the client plugin changes. The | 80 * Callback function called when the state of the client plugin changes. The |
105 * current and previous states are available via the |state| member variable. | 81 * current and previous states are available via the |state| member variable. |
106 * | 82 * |
107 * @param {remoting.ClientSession.StateEvent} state | 83 * @param {remoting.ClientSession.StateEvent} state |
108 */ | 84 */ |
109 function onClientStateChange_(state) { | 85 function onClientStateChange_(state) { |
110 switch (state.current) { | 86 switch (state.current) { |
111 case remoting.ClientSession.State.CLOSED: | 87 case remoting.ClientSession.State.CLOSED: |
112 console.log('Connection closed by host'); | 88 console.log('Connection closed by host'); |
113 if (remoting.clientSession.getMode() == | 89 if (remoting.clientSession.getMode() == |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 304 } |
329 | 305 |
330 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved); | 306 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved); |
331 }; | 307 }; |
332 | 308 |
333 /** @param {remoting.ClientSession} clientSession */ | 309 /** @param {remoting.ClientSession} clientSession */ |
334 remoting.onConnected = function(clientSession) { | 310 remoting.onConnected = function(clientSession) { |
335 remoting.clientSession = clientSession; | 311 remoting.clientSession = clientSession; |
336 remoting.clientSession.addEventListener('stateChanged', onClientStateChange_); | 312 remoting.clientSession.addEventListener('stateChanged', onClientStateChange_); |
337 setConnectionInterruptedButtonsText_(); | 313 setConnectionInterruptedButtonsText_(); |
338 var connectedTo = document.getElementById('connected-to'); | |
339 connectedTo.innerText = remoting.connector.getHostDisplayName(); | |
340 document.getElementById('access-code-entry').value = ''; | 314 document.getElementById('access-code-entry').value = ''; |
341 remoting.setMode(remoting.AppMode.IN_SESSION); | 315 remoting.setMode(remoting.AppMode.IN_SESSION); |
342 remoting.toolbar.center(); | 316 remoting.toolbar.center(); |
343 remoting.toolbar.preview(); | 317 remoting.toolbar.preview(); |
344 remoting.clipboard.startSession(); | 318 remoting.clipboard.startSession(); |
345 updateStatistics_(); | 319 updateStatistics_(); |
346 if (remoting.connector.pairingRequested) { | 320 if (remoting.connector.pairingRequested) { |
347 /** | 321 /** |
348 * @param {string} clientId | 322 * @param {string} clientId |
349 * @param {string} sharedSecret | 323 * @param {string} sharedSecret |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 * Create a session connector if one doesn't already exist. | 367 * Create a session connector if one doesn't already exist. |
394 */ | 368 */ |
395 remoting.ensureSessionConnector_ = function() { | 369 remoting.ensureSessionConnector_ = function() { |
396 if (!remoting.connector) { | 370 if (!remoting.connector) { |
397 remoting.connector = new remoting.SessionConnector( | 371 remoting.connector = new remoting.SessionConnector( |
398 document.getElementById('client-plugin-container'), | 372 document.getElementById('client-plugin-container'), |
399 remoting.onConnected, | 373 remoting.onConnected, |
400 showConnectError_, remoting.onExtensionMessage); | 374 showConnectError_, remoting.onExtensionMessage); |
401 } | 375 } |
402 }; | 376 }; |
OLD | NEW |