OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
7 | 7 |
8 (function() { | 8 (function() { |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 }; | 179 }; |
180 | 180 |
181 /** | 181 /** |
182 * @param {remoting.Host} host | 182 * @param {remoting.Host} host |
183 * @private | 183 * @private |
184 */ | 184 */ |
185 remoting.It2MeActivity.prototype.connect_ = function(host) { | 185 remoting.It2MeActivity.prototype.connect_ = function(host) { |
186 base.dispose(this.desktopActivity_); | 186 base.dispose(this.desktopActivity_); |
187 this.desktopActivity_ = new remoting.DesktopRemotingActivity(this); | 187 this.desktopActivity_ = new remoting.DesktopRemotingActivity(this); |
188 var sessionConnector = remoting.SessionConnector.factory.createConnector( | 188 remoting.app.setConnectionMode(remoting.Application.Mode.IT2ME); |
189 document.getElementById('client-container'), | 189 this.desktopActivity_.start( |
190 remoting.app_capabilities(), | 190 host, new remoting.CredentialsProvider({ accessCode: this.passCode_ })); |
191 this.desktopActivity_); | |
192 sessionConnector.connect( | |
193 remoting.Application.Mode.IT2ME, host, | |
194 new remoting.CredentialsProvider({ accessCode: this.passCode_ })); | |
195 }; | 191 }; |
196 | 192 |
197 /** | 193 /** |
198 * TODO(jrw): Replace with remoting.Error.fromHttpStatus. | 194 * TODO(jrw): Replace with remoting.Error.fromHttpStatus. |
199 * @param {number} error An HTTP error code returned by the support-hosts | 195 * @param {number} error An HTTP error code returned by the support-hosts |
200 * endpoint. | 196 * endpoint. |
201 * @return {remoting.Error} The equivalent remoting.Error code. | 197 * @return {remoting.Error} The equivalent remoting.Error code. |
202 */ | 198 */ |
203 function translateSupportHostsError(error) { | 199 function translateSupportHostsError(error) { |
204 switch (error) { | 200 switch (error) { |
205 case 0: return new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE); | 201 case 0: return new remoting.Error(remoting.Error.Tag.NETWORK_FAILURE); |
206 case 404: return new remoting.Error(remoting.Error.Tag.INVALID_ACCESS_CODE); | 202 case 404: return new remoting.Error(remoting.Error.Tag.INVALID_ACCESS_CODE); |
207 case 502: // No break | 203 case 502: // No break |
208 case 503: return new remoting.Error(remoting.Error.Tag.SERVICE_UNAVAILABLE); | 204 case 503: return new remoting.Error(remoting.Error.Tag.SERVICE_UNAVAILABLE); |
209 default: return remoting.Error.unexpected(); | 205 default: return remoting.Error.unexpected(); |
210 } | 206 } |
211 } | 207 } |
212 | 208 |
213 })(); | 209 })(); |
OLD | NEW |