OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 10 /** |
11 * Initialize the host list. | 11 * Initialize the host list. |
12 */ | 12 */ |
13 remoting.initHostlist_ = function() { | 13 remoting.initHostlist_ = function() { |
14 remoting.hostList = new remoting.HostList( | 14 remoting.hostList = new remoting.HostList( |
15 document.getElementById('host-list'), | 15 document.getElementById('host-list'), |
16 document.getElementById('host-list-empty'), | 16 document.getElementById('host-list-empty'), |
17 document.getElementById('host-list-error-message'), | 17 document.getElementById('host-list-error-message'), |
18 document.getElementById('host-list-refresh-failed-button'), | 18 document.getElementById('host-list-refresh-failed-button'), |
19 document.getElementById('host-list-loading-indicator')); | 19 document.getElementById('host-list-loading-indicator')); |
20 | 20 |
21 isHostModeSupported_().then( | 21 isHostModeSupported_().then( |
22 /** @param {Boolean} supported */ | 22 /** @param {Boolean} supported */ |
23 function(supported){ | 23 function(supported) { |
24 if (supported) { | 24 if (supported) { |
25 var noShare = document.getElementById('chrome-os-no-share'); | 25 var noShare = document.getElementById('unsupported-platform-message'); |
26 noShare.parentNode.removeChild(noShare); | 26 noShare.parentNode.removeChild(noShare); |
27 } else { | 27 } else { |
28 var button = document.getElementById('share-button'); | 28 var button = document.getElementById('share-button'); |
29 button.disabled = true; | 29 button.disabled = true; |
30 } | 30 } |
31 }); | 31 }); |
32 | 32 |
33 /** | 33 /** |
34 * @return {Promise} A promise that resolves to the id of the current | 34 * @return {Promise} A promise that resolves to the id of the current |
35 * containing tab/window. | 35 * containing tab/window. |
36 */ | 36 */ |
37 var getCurrentId = function () { | 37 var getCurrentId = function () { |
38 if (base.isAppsV2()) { | 38 if (base.isAppsV2()) { |
39 return Promise.resolve(chrome.app.window.current().id); | 39 return Promise.resolve(chrome.app.window.current().id); |
40 } | 40 } |
41 | 41 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 } | 81 } |
82 } | 82 } |
83 // No valid URL parameters, start up normally. | 83 // No valid URL parameters, start up normally. |
84 remoting.initHomeScreenUi(); | 84 remoting.initHomeScreenUi(); |
85 } | 85 } |
86 remoting.hostList.load(onLoad); | 86 remoting.hostList.load(onLoad); |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * Returns whether Host mode is supported on this platform for It2me. | 90 * Returns whether Host mode is supported on this platform for It2me. |
91 * TODO(kelvinp): Remove this function once It2me is enabled on Chrome OS (See | 91 * TODO(kelvinp): Remove this function once It2me is enabled on Chrome OS (See |
kelvinp
2015/01/23 21:15:33
Can you help me to move the TODO statement to line
Sergey Ulanov
2015/01/23 21:26:19
I don't think we need this TODO at all. This logic
| |
92 * crbug.com/429860). | 92 * crbug.com/429860). |
93 * | 93 * |
94 * @return {Promise} Resolves to true if Host mode is supported. | 94 * @return {Promise} Resolves to true if Host mode is supported. |
95 */ | 95 */ |
96 function isHostModeSupported_() { | 96 function isHostModeSupported_() { |
97 if (!remoting.platformIsChromeOS()) { | 97 if (remoting.HostInstaller.canInstall()) { |
98 return Promise.resolve(true); | 98 return Promise.resolve(true); |
99 } | 99 } |
100 // Sharing on Chrome OS is currently behind a flag. | 100 // Sharing on Chrome OS is currently behind a flag. |
101 // isInstalled() will return false if the flag is disabled. | 101 // isInstalled() will return false if the flag is disabled. |
102 var hostInstaller = new remoting.HostInstaller(); | 102 var hostInstaller = new remoting.HostInstaller(); |
103 return hostInstaller.isInstalled(); | 103 return hostInstaller.isInstalled(); |
104 } | 104 } |
105 | 105 |
106 /** | 106 /** |
107 * initHomeScreenUi is called if the app is not starting up in session mode, | 107 * initHomeScreenUi is called if the app is not starting up in session mode, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 remoting.startDesktopRemoting = function() { | 206 remoting.startDesktopRemoting = function() { |
207 remoting.app = new remoting.Application(); | 207 remoting.app = new remoting.Application(); |
208 var desktop_remoting = new remoting.DesktopRemoting(remoting.app); | 208 var desktop_remoting = new remoting.DesktopRemoting(remoting.app); |
209 remoting.app.start(); | 209 remoting.app.start(); |
210 }; | 210 }; |
211 | 211 |
212 window.addEventListener('load', remoting.startDesktopRemotingForTesting, false); | 212 window.addEventListener('load', remoting.startDesktopRemotingForTesting, false); |
OLD | NEW |