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 '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; |
(...skipping 11 matching lines...) Expand all Loading... |
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 UNEXPECTED: /*i18n-content*/'ERROR_UNEXPECTED', |
25 SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE' | 25 SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE' |
26 }; | 26 }; |
27 | 27 |
28 /** | 28 /** |
29 * Entry point for app initialization. | 29 * Entry point for app initialization. |
30 */ | 30 */ |
31 remoting.init = function() { | 31 remoting.init = function() { |
| 32 remoting.logExtensionInfoAsync_(); |
32 l10n.localize(); | 33 l10n.localize(); |
33 var button = document.getElementById('toggle-scaling'); | 34 var button = document.getElementById('toggle-scaling'); |
34 button.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_SCALING'); | 35 button.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_SCALING'); |
35 // Create global objects. | 36 // Create global objects. |
36 remoting.oauth2 = new remoting.OAuth2(); | 37 remoting.oauth2 = new remoting.OAuth2(); |
37 remoting.stats = new remoting.ConnectionStats( | 38 remoting.stats = new remoting.ConnectionStats( |
38 document.getElementById('statistics')); | 39 document.getElementById('statistics')); |
39 remoting.formatIq = new remoting.FormatIq(); | 40 remoting.formatIq = new remoting.FormatIq(); |
40 remoting.hostList = new remoting.HostList( | 41 remoting.hostList = new remoting.HostList( |
41 document.getElementById('host-list'), | 42 document.getElementById('host-list'), |
(...skipping 27 matching lines...) Expand all Loading... |
69 if (isHostModeSupported_()) { | 70 if (isHostModeSupported_()) { |
70 var noShare = document.getElementById('chrome-os-no-share'); | 71 var noShare = document.getElementById('chrome-os-no-share'); |
71 noShare.parentNode.removeChild(noShare); | 72 noShare.parentNode.removeChild(noShare); |
72 } else { | 73 } else { |
73 var button = document.getElementById('share-button'); | 74 var button = document.getElementById('share-button'); |
74 button.disabled = true; | 75 button.disabled = true; |
75 } | 76 } |
76 }; | 77 }; |
77 | 78 |
78 /** | 79 /** |
| 80 * Log information about the current extension. |
| 81 * The extension manifest is loaded and parsed to extract this info. |
| 82 */ |
| 83 remoting.logExtensionInfoAsync_ = function() { |
| 84 /** @type {XMLHttpRequest} */ |
| 85 var xhr = new XMLHttpRequest(); |
| 86 xhr.open('GET', 'manifest.json'); |
| 87 xhr.onload = function(e) { |
| 88 var manifest = |
| 89 /** @type {{name: string, version: string, default_locale: string}} */ |
| 90 JSON.parse(xhr.responseText); |
| 91 console.log(manifest.name + ' version: ' + manifest.version); |
| 92 } |
| 93 xhr.send(null); |
| 94 }; |
| 95 |
| 96 /** |
79 * If the client is connected, or the host is shared, prompt before closing. | 97 * If the client is connected, or the host is shared, prompt before closing. |
80 * | 98 * |
81 * @return {?string} The prompt string if a connection is active. | 99 * @return {?string} The prompt string if a connection is active. |
82 */ | 100 */ |
83 remoting.promptClose = function() { | 101 remoting.promptClose = function() { |
84 switch (remoting.currentMode) { | 102 switch (remoting.currentMode) { |
85 case remoting.AppMode.CLIENT_CONNECTING: | 103 case remoting.AppMode.CLIENT_CONNECTING: |
86 case remoting.AppMode.HOST_WAITING_FOR_CODE: | 104 case remoting.AppMode.HOST_WAITING_FOR_CODE: |
87 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: | 105 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: |
88 case remoting.AppMode.HOST_SHARED: | 106 case remoting.AppMode.HOST_SHARED: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 185 |
168 /** | 186 /** |
169 * Returns whether Host mode is supported on this platform. | 187 * Returns whether Host mode is supported on this platform. |
170 * | 188 * |
171 * @return {boolean} True if Host mode is supported. | 189 * @return {boolean} True if Host mode is supported. |
172 */ | 190 */ |
173 function isHostModeSupported_() { | 191 function isHostModeSupported_() { |
174 // Currently, sharing on Chromebooks is not supported. | 192 // Currently, sharing on Chromebooks is not supported. |
175 return !navigator.userAgent.match(/\bCrOS\b/); | 193 return !navigator.userAgent.match(/\bCrOS\b/); |
176 } | 194 } |
OLD | NEW |