Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: remoting/webapp/crd/js/host_session.js

Issue 895723006: Fix It2Me Host doesn't kill the native process after canceling a share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/it2me_host_facade.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 */ 22 */
22 remoting.HostSession = function() { 23 remoting.HostSession = function() {
23 /** @type {remoting.It2MeHostFacade} @private */ 24 /** @type {remoting.It2MeHostFacade} @private */
24 this.hostFacade_ = null; 25 this.hostFacade_ = null;
25 }; 26 };
26 27
27 // Note that these values are copied directly from host_script_object.h and 28 // Note that these values are copied directly from host_script_object.h and
28 // must be kept in sync. 29 // must be kept in sync.
29 /** @enum {number} */ 30 /** @enum {number} */
30 remoting.HostSession.State = { 31 remoting.HostSession.State = {
31 UNKNOWN: -1, 32 UNKNOWN: -1,
32 DISCONNECTED: 0, 33 DISCONNECTED: 0,
33 STARTING: 1, 34 STARTING: 1,
34 REQUESTED_ACCESS_CODE: 2, 35 REQUESTED_ACCESS_CODE: 2,
35 RECEIVED_ACCESS_CODE: 3, 36 RECEIVED_ACCESS_CODE: 3,
36 CONNECTED: 4, 37 CONNECTED: 4,
37 DISCONNECTING: 5, 38 DISCONNECTING: 5,
38 ERROR: 6, 39 ERROR: 6,
39 INVALID_DOMAIN_ERROR: 7 40 INVALID_DOMAIN_ERROR: 7
40 }; 41 };
41 42
43 remoting.HostSession.prototype.dispose = function() {
44 base.dispose(this.hostFacade_);
45 this.hostFacade_ = null;
46 };
47
42 /** 48 /**
43 * @param {string} stateString The string representation of the host state. 49 * @param {string} stateString The string representation of the host state.
44 * @return {remoting.HostSession.State} The HostSession.State enum value 50 * @return {remoting.HostSession.State} The HostSession.State enum value
45 * corresponding to stateString. 51 * corresponding to stateString.
46 */ 52 */
47 remoting.HostSession.State.fromString = function(stateString) { 53 remoting.HostSession.State.fromString = function(stateString) {
48 if (!remoting.HostSession.State.hasOwnProperty(stateString)) { 54 if (!remoting.HostSession.State.hasOwnProperty(stateString)) {
49 console.error('Unexpected HostSession.State string: ', stateString); 55 console.error('Unexpected HostSession.State string: ', stateString);
50 return remoting.HostSession.State.UNKNOWN; 56 return remoting.HostSession.State.UNKNOWN;
51 } 57 }
52 return remoting.HostSession.State[stateString]; 58 return remoting.HostSession.State[stateString];
53 } 59 };
54 60
55 /** 61 /**
56 * Initiates a connection. 62 * Initiates a connection.
57 * @param {remoting.It2MeHostFacade} hostFacade It2Me host facade to use. 63 * @param {remoting.It2MeHostFacade} hostFacade It2Me host facade to use.
58 * @param {string} email The user's email address. 64 * @param {string} email The user's email address.
59 * @param {string} accessToken A valid OAuth2 access token. 65 * @param {string} accessToken A valid OAuth2 access token.
60 * @param {function(remoting.HostSession.State):void} onStateChanged 66 * @param {function(remoting.HostSession.State):void} onStateChanged
61 * Callback for notifications of changes to the host plugin's state. 67 * Callback for notifications of changes to the host plugin's state.
62 * @param {function(boolean):void} onNatTraversalPolicyChanged Callback 68 * @param {function(boolean):void} onNatTraversalPolicyChanged Callback
63 * for notification of changes to the NAT traversal policy. 69 * for notification of changes to the NAT traversal policy.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return this.hostFacade_.getClient(); 113 return this.hostFacade_.getClient();
108 }; 114 };
109 115
110 /** 116 /**
111 * Disconnect the it2me session. 117 * Disconnect the it2me session.
112 * @return {void} Nothing. 118 * @return {void} Nothing.
113 */ 119 */
114 remoting.HostSession.prototype.disconnect = function() { 120 remoting.HostSession.prototype.disconnect = function() {
115 this.hostFacade_.disconnect(); 121 this.hostFacade_.disconnect();
116 }; 122 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/it2me_host_facade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698