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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.desktopConnectedView.getMode() == | 73 if (remoting.desktopConnectedView.getMode() == |
74 remoting.DesktopConnectedView.Mode.IT2ME) { | 74 remoting.DesktopConnectedView.Mode.IT2ME) { |
75 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); | 75 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
76 remoting.hangoutSessionEvents.raiseEvent( | |
77 remoting.hangoutSessionEvents.sessionStateChanged, | |
78 remoting.ClientSession.State.CLOSED); | |
79 } else { | 76 } else { |
80 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); | 77 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); |
81 } | 78 } |
82 remoting.app.onDisconnected(); | 79 remoting.app.onDisconnected(); |
83 break; | 80 break; |
84 | 81 |
85 case remoting.ClientSession.State.FAILED: | 82 case remoting.ClientSession.State.FAILED: |
86 var error = remoting.clientSession.getError(); | 83 var error = remoting.clientSession.getError(); |
87 console.error('Client plugin reported connection failed: ' + error); | 84 console.error('Client plugin reported connection failed: ' + error); |
88 if (error == null) { | 85 if (error == null) { |
(...skipping 25 matching lines...) Expand all Loading... |
114 remoting.clientSession.getState() != | 111 remoting.clientSession.getState() != |
115 remoting.ClientSession.State.CONNECTED) { | 112 remoting.ClientSession.State.CONNECTED) { |
116 return; | 113 return; |
117 } | 114 } |
118 var perfstats = remoting.clientSession.getPerfStats(); | 115 var perfstats = remoting.clientSession.getPerfStats(); |
119 remoting.stats.update(perfstats); | 116 remoting.stats.update(perfstats); |
120 remoting.clientSession.logStatistics(perfstats); | 117 remoting.clientSession.logStatistics(perfstats); |
121 // Update the stats once per second. | 118 // Update the stats once per second. |
122 window.setTimeout(updateStatistics_, 1000); | 119 window.setTimeout(updateStatistics_, 1000); |
123 } | 120 } |
OLD | NEW |