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 * Functions related to the 'host screen' for Chromoting. | 7 * Functions related to the 'host screen' for Chromoting. |
8 */ | 8 */ |
9 | 9 |
10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 */ | 87 */ |
88 remoting.tryShareWithToken_ = function(hostFacade, token) { | 88 remoting.tryShareWithToken_ = function(hostFacade, token) { |
89 lastShareWasCancelled_ = false; | 89 lastShareWasCancelled_ = false; |
90 onNatTraversalPolicyChanged_(true); // Hide warning by default. | 90 onNatTraversalPolicyChanged_(true); // Hide warning by default. |
91 remoting.setMode(remoting.AppMode.HOST_WAITING_FOR_CODE); | 91 remoting.setMode(remoting.AppMode.HOST_WAITING_FOR_CODE); |
92 document.getElementById('cancel-share-button').disabled = false; | 92 document.getElementById('cancel-share-button').disabled = false; |
93 disableTimeoutCountdown_(); | 93 disableTimeoutCountdown_(); |
94 | 94 |
95 base.debug.assert(hostSession_ === null); | 95 base.debug.assert(hostSession_ === null); |
96 hostSession_ = new remoting.HostSession(); | 96 hostSession_ = new remoting.HostSession(); |
97 var email = /** @type {string} */ (remoting.identity.getCachedEmail()); | 97 remoting.identity.getEmail().then( |
98 hostSession_.connect( | 98 function(/** string */ email) { |
99 hostFacade, email, token, onHostStateChanged_, | 99 hostSession_.connect( |
100 onNatTraversalPolicyChanged_, logDebugInfo_, it2meConnectFailed_); | 100 hostFacade, email, token, onHostStateChanged_, |
| 101 onNatTraversalPolicyChanged_, logDebugInfo_, it2meConnectFailed_); |
| 102 }); |
101 }; | 103 }; |
102 | 104 |
103 /** | 105 /** |
104 * Callback for the host plugin to notify the web app of state changes. | 106 * Callback for the host plugin to notify the web app of state changes. |
105 * @param {remoting.HostSession.State} state The new state of the plugin. | 107 * @param {remoting.HostSession.State} state The new state of the plugin. |
106 * @return {void} Nothing. | 108 * @return {void} Nothing. |
107 */ | 109 */ |
108 function onHostStateChanged_(state) { | 110 function onHostStateChanged_(state) { |
109 if (state == remoting.HostSession.State.STARTING) { | 111 if (state == remoting.HostSession.State.STARTING) { |
110 // Nothing to do here. | 112 // Nothing to do here. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 */ | 331 */ |
330 function onNatTraversalPolicyChanged_(enabled) { | 332 function onNatTraversalPolicyChanged_(enabled) { |
331 var natBox = document.getElementById('nat-box'); | 333 var natBox = document.getElementById('nat-box'); |
332 if (enabled) { | 334 if (enabled) { |
333 natBox.classList.add('traversal-enabled'); | 335 natBox.classList.add('traversal-enabled'); |
334 } else { | 336 } else { |
335 natBox.classList.remove('traversal-enabled'); | 337 natBox.classList.remove('traversal-enabled'); |
336 } | 338 } |
337 } | 339 } |
338 | 340 |
339 })(); | 341 })(); |
OLD | NEW |