OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** @type {remoting.HostSession} */ remoting.hostSession = null; | 10 /** @type {remoting.HostSession} */ remoting.hostSession = null; |
11 | 11 |
12 /** | 12 /** |
13 * @enum {string} All error messages from messages.json | 13 * @enum {string} All error messages from messages.json |
14 */ | 14 */ |
15 remoting.Error = { | 15 remoting.Error = { |
16 NO_RESPONSE: /*i18n-content*/'ERROR_NO_RESPONSE', | 16 NO_RESPONSE: /*i18n-content*/'ERROR_NO_RESPONSE', |
17 INVALID_ACCESS_CODE: /*i18n-content*/'ERROR_INVALID_ACCESS_CODE', | 17 INVALID_ACCESS_CODE: /*i18n-content*/'ERROR_INVALID_ACCESS_CODE', |
18 MISSING_PLUGIN: /*i18n-content*/'ERROR_MISSING_PLUGIN', | 18 MISSING_PLUGIN: /*i18n-content*/'ERROR_MISSING_PLUGIN', |
19 AUTHENTICATION_FAILED: /*i18n-content*/'ERROR_AUTHENTICATION_FAILED', | 19 AUTHENTICATION_FAILED: /*i18n-content*/'ERROR_AUTHENTICATION_FAILED', |
20 HOST_IS_OFFLINE: /*i18n-content*/'ERROR_HOST_IS_OFFLINE', | 20 HOST_IS_OFFLINE: /*i18n-content*/'ERROR_HOST_IS_OFFLINE', |
21 INCOMPATIBLE_PROTOCOL: /*i18n-content*/'ERROR_INCOMPATIBLE_PROTOCOL', | 21 INCOMPATIBLE_PROTOCOL: /*i18n-content*/'ERROR_INCOMPATIBLE_PROTOCOL', |
22 BAD_PLUGIN_VERSION: /*i18n-content*/'ERROR_BAD_PLUGIN_VERSION', | 22 BAD_PLUGIN_VERSION: /*i18n-content*/'ERROR_BAD_PLUGIN_VERSION', |
23 GENERIC: /*i18n-content*/'ERROR_GENERIC' | 23 GENERIC: /*i18n-content*/'ERROR_GENERIC', |
| 24 UNEXPECTED: /*i18n-content*/'ERROR_UNEXPECTED' |
24 }; | 25 }; |
25 | 26 |
26 (function() { | 27 (function() { |
27 | 28 |
28 /** | 29 /** |
29 * Entry point for app initialization. | 30 * Entry point for app initialization. |
30 */ | 31 */ |
31 remoting.init = function() { | 32 remoting.init = function() { |
32 l10n.localize(); | 33 l10n.localize(); |
33 var button = document.getElementById('toggle-scaling'); | 34 var button = document.getElementById('toggle-scaling'); |
(...skipping 14 matching lines...) Expand all Loading... |
48 if (email) { | 49 if (email) { |
49 document.getElementById('current-email').innerText = email; | 50 document.getElementById('current-email').innerText = email; |
50 } | 51 } |
51 | 52 |
52 window.addEventListener('blur', pluginLostFocus_, false); | 53 window.addEventListener('blur', pluginLostFocus_, false); |
53 | 54 |
54 // Parse URL parameters. | 55 // Parse URL parameters. |
55 var urlParams = getUrlParameters(); | 56 var urlParams = getUrlParameters(); |
56 if ('mode' in urlParams) { | 57 if ('mode' in urlParams) { |
57 if (urlParams['mode'] == 'me2me') { | 58 if (urlParams['mode'] == 'me2me') { |
58 var hostJid = urlParams['hostJid']; | 59 var hostId = urlParams['hostId']; |
59 var hostPublicKey = urlParams['hostPublicKey']; | 60 remoting.connectHost(hostId, true); |
60 var hostName = urlParams['hostName']; | |
61 remoting.connectHost(hostJid, hostPublicKey, hostName); | |
62 return; | 61 return; |
63 } | 62 } |
64 } | 63 } |
65 | 64 |
66 // No valid URL parameters, start up normally. | 65 // No valid URL parameters, start up normally. |
67 remoting.setMode(getAppStartupMode_()); | 66 remoting.setMode(getAppStartupMode_()); |
68 if (isHostModeSupported_()) { | 67 if (isHostModeSupported_()) { |
69 var noShare = document.getElementById('chrome-os-no-share'); | 68 var noShare = document.getElementById('chrome-os-no-share'); |
70 noShare.parentNode.removeChild(noShare); | 69 noShare.parentNode.removeChild(noShare); |
71 } else { | 70 } else { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 /** | 173 /** |
175 * Returns whether Host mode is supported on this platform. | 174 * Returns whether Host mode is supported on this platform. |
176 * | 175 * |
177 * @return {boolean} True if Host mode is supported. | 176 * @return {boolean} True if Host mode is supported. |
178 */ | 177 */ |
179 function isHostModeSupported_() { | 178 function isHostModeSupported_() { |
180 // Currently, sharing on Chromebooks is not supported. | 179 // Currently, sharing on Chromebooks is not supported. |
181 return !navigator.userAgent.match(/\bCrOS\b/); | 180 return !navigator.userAgent.match(/\bCrOS\b/); |
182 } | 181 } |
183 }()); | 182 }()); |
OLD | NEW |