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 * Class handling creation and teardown of a remoting host session. | 7 * Class handling creation and teardown of a remoting host session. |
8 * | 8 * |
9 * This abstracts a <embed> element and controls the plugin which does the | 9 * This abstracts a <embed> element and controls the plugin which does the |
10 * actual remoting work. There should be no UI code inside this class. It | 10 * actual remoting work. There should be no UI code inside this class. It |
11 * should be purely thought of as a controller of sorts. | 11 * should be purely thought of as a controller of sorts. |
12 */ | 12 */ |
13 | 13 |
14 'use strict'; | 14 'use strict'; |
15 | 15 |
16 /** @suppress {duplicate} */ | 16 /** @suppress {duplicate} */ |
17 var remoting = remoting || {}; | 17 var remoting = remoting || {}; |
18 | 18 |
19 /** | 19 /** |
20 * @constructor | 20 * @constructor |
21 * @implements {base.Disposable} | 21 * @implements {base.Disposable} |
22 */ | 22 */ |
23 remoting.HostSession = function() { | 23 remoting.HostSession = function() { |
24 /** @type {remoting.It2MeHostFacade} @private */ | 24 /** @type {remoting.It2MeHostFacade} @private */ |
25 this.hostFacade_ = null; | 25 this.hostFacade_ = null; |
26 }; | 26 }; |
27 | 27 |
28 // Note that these values are copied directly from host_script_object.h and | 28 // Note that these values are copied directly from it2me_host.h and must be kept |
29 // must be kept in sync. | 29 // in sync. |
30 /** @enum {number} */ | 30 /** @enum {number} */ |
31 remoting.HostSession.State = { | 31 remoting.HostSession.State = { |
32 UNKNOWN: -1, | 32 UNKNOWN: -1, |
33 DISCONNECTED: 0, | 33 DISCONNECTED: 0, |
34 STARTING: 1, | 34 STARTING: 1, |
35 REQUESTED_ACCESS_CODE: 2, | 35 REQUESTED_ACCESS_CODE: 2, |
36 RECEIVED_ACCESS_CODE: 3, | 36 RECEIVED_ACCESS_CODE: 3, |
37 CONNECTED: 4, | 37 CONNECTING: 4, |
38 DISCONNECTING: 5, | 38 CONNECTED: 5, |
39 ERROR: 6, | 39 DISCONNECTING: 6, |
40 INVALID_DOMAIN_ERROR: 7 | 40 ERROR: 7, |
| 41 INVALID_DOMAIN_ERROR: 8, |
41 }; | 42 }; |
42 | 43 |
43 remoting.HostSession.prototype.dispose = function() { | 44 remoting.HostSession.prototype.dispose = function() { |
44 base.dispose(this.hostFacade_); | 45 base.dispose(this.hostFacade_); |
45 this.hostFacade_ = null; | 46 this.hostFacade_ = null; |
46 }; | 47 }; |
47 | 48 |
48 /** | 49 /** |
49 * @param {string} stateString The string representation of the host state. | 50 * @param {string} stateString The string representation of the host state. |
50 * @return {remoting.HostSession.State} The HostSession.State enum value | 51 * @return {remoting.HostSession.State} The HostSession.State enum value |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return this.hostFacade_.getClient(); | 112 return this.hostFacade_.getClient(); |
112 }; | 113 }; |
113 | 114 |
114 /** | 115 /** |
115 * Disconnect the it2me session. | 116 * Disconnect the it2me session. |
116 * @return {void} Nothing. | 117 * @return {void} Nothing. |
117 */ | 118 */ |
118 remoting.HostSession.prototype.disconnect = function() { | 119 remoting.HostSession.prototype.disconnect = function() { |
119 this.hostFacade_.disconnect(); | 120 this.hostFacade_.disconnect(); |
120 }; | 121 }; |
OLD | NEW |