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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 remoting.clientSession.disconnect(remoting.Error.NONE); | 58 remoting.clientSession.disconnect(remoting.Error.NONE); |
59 remoting.clientSession = null; | 59 remoting.clientSession = null; |
60 console.log('Disconnected.'); | 60 console.log('Disconnected.'); |
61 }; | 61 }; |
62 | 62 |
63 /** | 63 /** |
64 * Callback function called when the state of the client plugin changes. The | 64 * Callback function called when the state of the client plugin changes. The |
65 * current and previous states are available via the |state| member variable. | 65 * current and previous states are available via the |state| member variable. |
66 * | 66 * |
67 * @param {remoting.ClientSession.StateEvent} state | 67 * @param {remoting.ClientSession.StateEvent=} state |
68 */ | 68 */ |
69 function onClientStateChange_(state) { | 69 function onClientStateChange_(state) { |
70 switch (state.current) { | 70 switch (state.current) { |
71 case remoting.ClientSession.State.CLOSED: | 71 case remoting.ClientSession.State.CLOSED: |
72 console.log('Connection closed by host'); | 72 console.log('Connection closed by host'); |
73 if (remoting.clientSession.getMode() == | 73 if (remoting.clientSession.getMode() == |
74 remoting.ClientSession.Mode.IT2ME) { | 74 remoting.ClientSession.Mode.IT2ME) { |
75 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); | 75 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
76 remoting.hangoutSessionEvents.raiseEvent( | 76 remoting.hangoutSessionEvents.raiseEvent( |
77 remoting.hangoutSessionEvents.sessionStateChanged, | 77 remoting.hangoutSessionEvents.sessionStateChanged, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 remoting.clientSession.getState() != | 112 remoting.clientSession.getState() != |
113 remoting.ClientSession.State.CONNECTED) { | 113 remoting.ClientSession.State.CONNECTED) { |
114 return; | 114 return; |
115 } | 115 } |
116 var perfstats = remoting.clientSession.getPerfStats(); | 116 var perfstats = remoting.clientSession.getPerfStats(); |
117 remoting.stats.update(perfstats); | 117 remoting.stats.update(perfstats); |
118 remoting.clientSession.logStatistics(perfstats); | 118 remoting.clientSession.logStatistics(perfstats); |
119 // Update the stats once per second. | 119 // Update the stats once per second. |
120 window.setTimeout(updateStatistics_, 1000); | 120 window.setTimeout(updateStatistics_, 1000); |
121 } | 121 } |
OLD | NEW |