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 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 * Initiates a connection. | 63 * Initiates a connection. |
64 * @param {remoting.It2MeHostFacade} hostFacade It2Me host facade to use. | 64 * @param {remoting.It2MeHostFacade} hostFacade It2Me host facade to use. |
65 * @param {string} email The user's email address. | 65 * @param {string} email The user's email address. |
66 * @param {string} accessToken A valid OAuth2 access token. | 66 * @param {string} accessToken A valid OAuth2 access token. |
67 * @param {function(remoting.HostSession.State):void} onStateChanged | 67 * @param {function(remoting.HostSession.State):void} onStateChanged |
68 * Callback for notifications of changes to the host plugin's state. | 68 * Callback for notifications of changes to the host plugin's state. |
69 * @param {function(boolean):void} onNatTraversalPolicyChanged Callback | 69 * @param {function(boolean):void} onNatTraversalPolicyChanged Callback |
70 * for notification of changes to the NAT traversal policy. | 70 * for notification of changes to the NAT traversal policy. |
71 * @param {function(string):void} logDebugInfo Callback allowing the plugin | 71 * @param {function(string):void} logDebugInfo Callback allowing the plugin |
72 * to log messages to the debug log. | 72 * to log messages to the debug log. |
73 * @param {function():void} onError Callback to invoke in case of an error. | 73 * @param {function(remoting.Error):void} onError Callback to invoke in case |
| 74 * of an error. |
74 */ | 75 */ |
75 remoting.HostSession.prototype.connect = | 76 remoting.HostSession.prototype.connect = |
76 function(hostFacade, email, accessToken, onStateChanged, | 77 function(hostFacade, email, accessToken, onStateChanged, |
77 onNatTraversalPolicyChanged, logDebugInfo, onError) { | 78 onNatTraversalPolicyChanged, logDebugInfo, onError) { |
78 /** @private */ | 79 /** @private */ |
79 this.hostFacade_ = hostFacade; | 80 this.hostFacade_ = hostFacade; |
80 | 81 |
81 this.hostFacade_.connect(email, 'oauth2:' + accessToken, onStateChanged, | 82 this.hostFacade_.connect(email, 'oauth2:' + accessToken, onStateChanged, |
82 onNatTraversalPolicyChanged, logDebugInfo, | 83 onNatTraversalPolicyChanged, logDebugInfo, |
83 remoting.settings.XMPP_SERVER, | 84 remoting.settings.XMPP_SERVER, |
(...skipping 28 matching lines...) Expand all Loading... |
112 return this.hostFacade_.getClient(); | 113 return this.hostFacade_.getClient(); |
113 }; | 114 }; |
114 | 115 |
115 /** | 116 /** |
116 * Disconnect the it2me session. | 117 * Disconnect the it2me session. |
117 * @return {void} Nothing. | 118 * @return {void} Nothing. |
118 */ | 119 */ |
119 remoting.HostSession.prototype.disconnect = function() { | 120 remoting.HostSession.prototype.disconnect = function() { |
120 this.hostFacade_.disconnect(); | 121 this.hostFacade_.disconnect(); |
121 }; | 122 }; |
OLD | NEW |