| 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; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 remoting.hostList = new remoting.HostList( | 40 remoting.hostList = new remoting.HostList( |
| 41 document.getElementById('host-list'), | 41 document.getElementById('host-list'), |
| 42 document.getElementById('host-list-error')); | 42 document.getElementById('host-list-error')); |
| 43 | 43 |
| 44 refreshEmail_(); | 44 refreshEmail_(); |
| 45 var email = remoting.oauth2.getCachedEmail(); | 45 var email = remoting.oauth2.getCachedEmail(); |
| 46 if (email) { | 46 if (email) { |
| 47 document.getElementById('current-email').innerText = email; | 47 document.getElementById('current-email').innerText = email; |
| 48 } | 48 } |
| 49 | 49 |
| 50 window.addEventListener('blur', pluginLostFocus_, false); |
| 51 |
| 52 // Parse URL parameters. |
| 53 var urlParams = getUrlParameters(); |
| 54 if ('mode' in urlParams) { |
| 55 if (urlParams['mode'] == 'me2me') { |
| 56 var hostJid = urlParams['hostJid']; |
| 57 var hostPublicKey = urlParams['hostPublicKey']; |
| 58 var hostName = urlParams['hostName']; |
| 59 remoting.connectHost(hostJid, hostPublicKey, hostName); |
| 60 return; |
| 61 } |
| 62 } |
| 63 |
| 64 // No valid URL parameters, start up normally. |
| 50 remoting.setMode(getAppStartupMode_()); | 65 remoting.setMode(getAppStartupMode_()); |
| 51 if (isHostModeSupported_()) { | 66 if (isHostModeSupported_()) { |
| 52 var noShare = document.getElementById('chrome-os-no-share'); | 67 var noShare = document.getElementById('chrome-os-no-share'); |
| 53 noShare.parentNode.removeChild(noShare); | 68 noShare.parentNode.removeChild(noShare); |
| 54 } else { | 69 } else { |
| 55 var button = document.getElementById('share-button'); | 70 var button = document.getElementById('share-button'); |
| 56 button.disabled = true; | 71 button.disabled = true; |
| 57 } | 72 } |
| 58 | |
| 59 window.addEventListener('blur', pluginLostFocus_, false); | |
| 60 } | 73 } |
| 61 | 74 |
| 62 remoting.cancelPendingOperation = function() { | 75 remoting.cancelPendingOperation = function() { |
| 63 document.getElementById('cancel-button').disabled = true; | 76 document.getElementById('cancel-button').disabled = true; |
| 64 switch (remoting.getMajorMode()) { | 77 switch (remoting.getMajorMode()) { |
| 65 case remoting.AppMode.HOST: | 78 case remoting.AppMode.HOST: |
| 66 remoting.cancelShare(); | 79 remoting.cancelShare(); |
| 67 break; | 80 break; |
| 68 case remoting.AppMode.CLIENT: | 81 case remoting.AppMode.CLIENT: |
| 69 remoting.cancelConnect(); | 82 remoting.cancelConnect(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 /** | 172 /** |
| 160 * Returns whether Host mode is supported on this platform. | 173 * Returns whether Host mode is supported on this platform. |
| 161 * | 174 * |
| 162 * @return {boolean} True if Host mode is supported. | 175 * @return {boolean} True if Host mode is supported. |
| 163 */ | 176 */ |
| 164 function isHostModeSupported_() { | 177 function isHostModeSupported_() { |
| 165 // Currently, sharing on Chromebooks is not supported. | 178 // Currently, sharing on Chromebooks is not supported. |
| 166 return !navigator.userAgent.match(/\bCrOS\b/); | 179 return !navigator.userAgent.match(/\bCrOS\b/); |
| 167 } | 180 } |
| 168 }()); | 181 }()); |
| OLD | NEW |