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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 this.hostDispatcher_ = new remoting.HostIt2MeDispatcher(); | 87 this.hostDispatcher_ = new remoting.HostIt2MeDispatcher(); |
88 | 88 |
89 /** @return {remoting.HostPlugin} */ | 89 /** @return {remoting.HostPlugin} */ |
90 var createPluginForIt2Me = function() { | 90 var createPluginForIt2Me = function() { |
91 var plugin = remoting.HostSession.createPlugin(); | 91 var plugin = remoting.HostSession.createPlugin(); |
92 container.appendChild(plugin); | 92 container.appendChild(plugin); |
93 return plugin; | 93 return plugin; |
94 }; | 94 }; |
95 | 95 |
96 this.hostDispatcher_.initAndConnect( | 96 this.hostDispatcher_.initAndConnect( |
97 createPluginForIt2Me, | 97 createPluginForIt2Me, email, 'oauth2:' + accessToken, |
98 email, 'oauth2:' + accessToken, | 98 onStateChanged, onNatTraversalPolicyChanged, logDebugInfo, |
99 onStateChanged, onNatTraversalPolicyChanged, | |
100 remoting.settings.XMPP_SERVER_ADDRESS, | 99 remoting.settings.XMPP_SERVER_ADDRESS, |
101 remoting.settings.XMPP_SERVER_USE_TLS, | 100 remoting.settings.XMPP_SERVER_USE_TLS, |
102 remoting.settings.DIRECTORY_BOT_JID, | 101 remoting.settings.DIRECTORY_BOT_JID, |
103 onError); | 102 onError); |
104 }; | 103 }; |
105 | 104 |
106 /** | 105 /** |
107 * Get the access code generated by the it2me host. Valid only after the | 106 * Get the access code generated by the it2me host. Valid only after the |
108 * host state is RECEIVED_ACCESS_CODE. | 107 * host state is RECEIVED_ACCESS_CODE. |
109 * @return {string} The access code. | 108 * @return {string} The access code. |
(...skipping 28 matching lines...) Expand all Loading... |
138 this.hostDispatcher_.disconnect(); | 137 this.hostDispatcher_.disconnect(); |
139 }; | 138 }; |
140 | 139 |
141 | 140 |
142 /** | 141 /** |
143 * @return {void} Nothing. | 142 * @return {void} Nothing. |
144 */ | 143 */ |
145 remoting.HostSession.prototype.cleanup = function() { | 144 remoting.HostSession.prototype.cleanup = function() { |
146 this.hostDispatcher_.cleanup(); | 145 this.hostDispatcher_.cleanup(); |
147 }; | 146 }; |
OLD | NEW |