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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 showConnectError_(error); | 129 showConnectError_(error); |
130 break; | 130 break; |
131 | 131 |
132 default: | 132 default: |
133 console.error('Unexpected client plugin state: ' + newState); | 133 console.error('Unexpected client plugin state: ' + newState); |
134 // This should only happen if the web-app and client plugin get out of | 134 // This should only happen if the web-app and client plugin get out of |
135 // sync, so MISSING_PLUGIN is a suitable error. | 135 // sync, so MISSING_PLUGIN is a suitable error. |
136 showConnectError_(remoting.Error.MISSING_PLUGIN); | 136 showConnectError_(remoting.Error.MISSING_PLUGIN); |
137 break; | 137 break; |
138 } | 138 } |
139 remoting.clientSession.disconnect(false); | |
139 remoting.clientSession.removePlugin(); | 140 remoting.clientSession.removePlugin(); |
140 remoting.clientSession = null; | 141 remoting.clientSession = null; |
141 } | 142 } |
142 | 143 |
143 /** | 144 /** |
144 * Show a client-side error message. | 145 * Show a client-side error message. |
145 * | 146 * |
146 * @param {remoting.Error} errorTag The error to be localized and | 147 * @param {remoting.Error} errorTag The error to be localized and |
147 * displayed. | 148 * displayed. |
148 * @return {void} Nothing. | 149 * @return {void} Nothing. |
149 */ | 150 */ |
150 function showConnectError_(errorTag) { | 151 function showConnectError_(errorTag) { |
151 console.error('Connection failed: ' + errorTag); | 152 console.error('Connection failed: ' + errorTag); |
152 var errorDiv = document.getElementById('connect-error-message'); | 153 var errorDiv = document.getElementById('connect-error-message'); |
153 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); | 154 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); |
154 remoting.accessCode = ''; | 155 remoting.accessCode = ''; |
155 var mode = remoting.clientSession ? remoting.clientSession.mode | 156 var mode = remoting.clientSession ? remoting.clientSession.mode |
156 : remoting.connector.getConnectionMode(); | 157 : remoting.connector.getConnectionMode(); |
157 if (mode == remoting.ClientSession.Mode.IT2ME) { | 158 if (mode == remoting.ClientSession.Mode.IT2ME) { |
158 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 159 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
159 } else { | 160 } else { |
160 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 161 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
161 } | 162 } |
162 if (remoting.clientSession) { | |
163 remoting.clientSession.disconnect(false); | |
164 remoting.clientSession = null; | |
165 } | |
Jamie
2013/02/14 01:13:33
The only case where showConnectError is called wit
| |
166 } | 163 } |
167 | 164 |
168 /** | 165 /** |
169 * Set the text on the buttons shown under the error message so that they are | 166 * Set the text on the buttons shown under the error message so that they are |
170 * easy to understand in the case where a successful connection failed, as | 167 * easy to understand in the case where a successful connection failed, as |
171 * opposed to the case where a connection never succeeded. | 168 * opposed to the case where a connection never succeeded. |
172 */ | 169 */ |
173 function setConnectionInterruptedButtonsText_() { | 170 function setConnectionInterruptedButtonsText_() { |
174 var button1 = document.getElementById('client-reconnect-button'); | 171 var button1 = document.getElementById('client-reconnect-button'); |
175 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); | 172 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 remoting.connector = null; | 231 remoting.connector = null; |
235 remoting.clientSession = clientSession; | 232 remoting.clientSession = clientSession; |
236 remoting.clientSession.setOnStateChange(onClientStateChange_); | 233 remoting.clientSession.setOnStateChange(onClientStateChange_); |
237 setConnectionInterruptedButtonsText_(); | 234 setConnectionInterruptedButtonsText_(); |
238 remoting.setMode(remoting.AppMode.IN_SESSION); | 235 remoting.setMode(remoting.AppMode.IN_SESSION); |
239 remoting.toolbar.center(); | 236 remoting.toolbar.center(); |
240 remoting.toolbar.preview(); | 237 remoting.toolbar.preview(); |
241 remoting.clipboard.startSession(); | 238 remoting.clipboard.startSession(); |
242 updateStatistics_(); | 239 updateStatistics_(); |
243 }; | 240 }; |
OLD | NEW |