Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 remoting.daemonPlugin.updateDom(); | 66 remoting.daemonPlugin.updateDom(); |
| 67 remoting.setMode(getAppStartupMode_()); | 67 remoting.setMode(getAppStartupMode_()); |
| 68 remoting.askPinDialog = new remoting.AskPinDialog(remoting.daemonPlugin); | 68 remoting.askPinDialog = new remoting.AskPinDialog(remoting.daemonPlugin); |
| 69 if (isHostModeSupported_()) { | 69 if (isHostModeSupported_()) { |
| 70 var noShare = document.getElementById('chrome-os-no-share'); | 70 var noShare = document.getElementById('chrome-os-no-share'); |
| 71 noShare.parentNode.removeChild(noShare); | 71 noShare.parentNode.removeChild(noShare); |
| 72 } else { | 72 } else { |
| 73 var button = document.getElementById('share-button'); | 73 var button = document.getElementById('share-button'); |
| 74 button.disabled = true; | 74 button.disabled = true; |
| 75 } | 75 } |
| 76 | |
| 77 remoting.logExtensionInfoAsync_(); | |
|
Jamie
2012/03/01 22:35:41
I think this would be better at the start of the f
garykac
2012/03/02 00:40:53
Done.
| |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 /** | 80 /** |
| 81 * Log information about the current extension. | |
| 82 * The extension manifest is loaded and parsed to extract this info. | |
| 83 */ | |
| 84 remoting.logExtensionInfoAsync_ = function() { | |
| 85 /** @type {XMLHttpRequest} */ | |
| 86 var xhr = new XMLHttpRequest(); | |
| 87 xhr.open('GET', 'manifest.json'); | |
| 88 xhr.onload = function(e) { | |
| 89 var manifest = | |
| 90 /** @type {{name: string, version: string, default_locale: string}} */ | |
| 91 JSON.parse(xhr.responseText); | |
| 92 console.log(manifest.name + ' version: ' + manifest.version + | |
| 93 ' (' + manifest.default_locale + ')'); | |
|
Jamie
2012/03/01 22:35:41
I don't think I'd bother with the default_locale.
garykac
2012/03/02 00:40:53
Done.
| |
| 94 } | |
| 95 xhr.send(null); | |
| 96 }; | |
| 97 | |
| 98 /** | |
| 79 * If the client is connected, or the host is shared, prompt before closing. | 99 * If the client is connected, or the host is shared, prompt before closing. |
| 80 * | 100 * |
| 81 * @return {?string} The prompt string if a connection is active. | 101 * @return {?string} The prompt string if a connection is active. |
| 82 */ | 102 */ |
| 83 remoting.promptClose = function() { | 103 remoting.promptClose = function() { |
| 84 switch (remoting.currentMode) { | 104 switch (remoting.currentMode) { |
| 85 case remoting.AppMode.CLIENT_CONNECTING: | 105 case remoting.AppMode.CLIENT_CONNECTING: |
| 86 case remoting.AppMode.HOST_WAITING_FOR_CODE: | 106 case remoting.AppMode.HOST_WAITING_FOR_CODE: |
| 87 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: | 107 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: |
| 88 case remoting.AppMode.HOST_SHARED: | 108 case remoting.AppMode.HOST_SHARED: |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 | 187 |
| 168 /** | 188 /** |
| 169 * Returns whether Host mode is supported on this platform. | 189 * Returns whether Host mode is supported on this platform. |
| 170 * | 190 * |
| 171 * @return {boolean} True if Host mode is supported. | 191 * @return {boolean} True if Host mode is supported. |
| 172 */ | 192 */ |
| 173 function isHostModeSupported_() { | 193 function isHostModeSupported_() { |
| 174 // Currently, sharing on Chromebooks is not supported. | 194 // Currently, sharing on Chromebooks is not supported. |
| 175 return !navigator.userAgent.match(/\bCrOS\b/); | 195 return !navigator.userAgent.match(/\bCrOS\b/); |
| 176 } | 196 } |
| OLD | NEW |