| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 refreshEmail_(); | 48 refreshEmail_(); |
| 49 var email = remoting.oauth2.getCachedEmail(); | 49 var email = remoting.oauth2.getCachedEmail(); |
| 50 if (email) { | 50 if (email) { |
| 51 document.getElementById('current-email').innerText = email; | 51 document.getElementById('current-email').innerText = email; |
| 52 } | 52 } |
| 53 | 53 |
| 54 window.addEventListener('blur', pluginLostFocus_, false); | 54 window.addEventListener('blur', pluginLostFocus_, false); |
| 55 | 55 |
| 56 // Parse URL parameters. | 56 // Parse URL parameters. |
| 57 var urlParams = getUrlParameters(); | 57 var urlParams = getUrlParameters_(); |
| 58 if ('mode' in urlParams) { | 58 if ('mode' in urlParams) { |
| 59 if (urlParams['mode'] == 'me2me') { | 59 if (urlParams['mode'] == 'me2me') { |
| 60 var hostId = urlParams['hostId']; | 60 var hostId = urlParams['hostId']; |
| 61 remoting.connectMe2Me(hostId, true); | 61 remoting.connectMe2Me(hostId, true); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // No valid URL parameters, start up normally. | 66 // No valid URL parameters, start up normally. |
| 67 remoting.daemonPlugin = new remoting.DaemonPlugin(); | 67 remoting.daemonPlugin = new remoting.DaemonPlugin(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 /** | 187 /** |
| 188 * Returns whether Host mode is supported on this platform. | 188 * Returns whether Host mode is supported on this platform. |
| 189 * | 189 * |
| 190 * @return {boolean} True if Host mode is supported. | 190 * @return {boolean} True if Host mode is supported. |
| 191 */ | 191 */ |
| 192 function isHostModeSupported_() { | 192 function isHostModeSupported_() { |
| 193 // Currently, sharing on Chromebooks is not supported. | 193 // Currently, sharing on Chromebooks is not supported. |
| 194 return !navigator.userAgent.match(/\bCrOS\b/); | 194 return !navigator.userAgent.match(/\bCrOS\b/); |
| 195 } | 195 } |
| 196 |
| 197 /** |
| 198 * @return {Object.<string, string>} The URL parameters. |
| 199 */ |
| 200 function getUrlParameters_() { |
| 201 var result = {}; |
| 202 var parts = window.location.search.substring(1).split('&'); |
| 203 for (var i = 0; i < parts.length; i++) { |
| 204 var pair = parts[i].split('='); |
| 205 result[pair[0]] = decodeURIComponent(pair[1]); |
| 206 } |
| 207 return result; |
| 208 } |
| OLD | NEW |