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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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.initNonSession(); | |
| 68 }; | |
| 69 | |
| 70 // initNonSession is called if the app is not starting up in session mode, and | |
| 71 // also if the user cancels the connection in session mode.2 | |
| 72 remoting.initNonSession = function () { | |
| 67 remoting.daemonPlugin = new remoting.DaemonPlugin(); | 73 remoting.daemonPlugin = new remoting.DaemonPlugin(); |
| 68 remoting.daemonPlugin.updateDom(); | 74 remoting.daemonPlugin.updateDom(); |
| 69 remoting.setMode(getAppStartupMode_()); | 75 remoting.setMode(getAppStartupMode_()); |
| 70 remoting.askPinDialog = new remoting.AskPinDialog(remoting.daemonPlugin); | 76 remoting.askPinDialog = new remoting.AskPinDialog(remoting.daemonPlugin); |
| 71 if (isHostModeSupported_()) { | 77 if (isHostModeSupported_()) { |
|
garykac
2012/03/12 20:03:12
As discussed: you can move these back into init().
Jamie
2012/03/14 18:47:11
Done.
| |
| 72 var noShare = document.getElementById('chrome-os-no-share'); | 78 var noShare = document.getElementById('chrome-os-no-share'); |
| 73 noShare.parentNode.removeChild(noShare); | 79 noShare.parentNode.removeChild(noShare); |
| 74 } else { | 80 } else { |
| 75 var button = document.getElementById('share-button'); | 81 var button = document.getElementById('share-button'); |
| 76 button.disabled = true; | 82 button.disabled = true; |
| 77 } | 83 } |
| 78 }; | 84 }; |
| 79 | 85 |
| 80 /** | 86 /** |
| 81 * Log information about the current extension. | 87 * Log information about the current extension. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 */ | 206 */ |
| 201 function getUrlParameters_() { | 207 function getUrlParameters_() { |
| 202 var result = {}; | 208 var result = {}; |
| 203 var parts = window.location.search.substring(1).split('&'); | 209 var parts = window.location.search.substring(1).split('&'); |
| 204 for (var i = 0; i < parts.length; i++) { | 210 for (var i = 0; i < parts.length; i++) { |
| 205 var pair = parts[i].split('='); | 211 var pair = parts[i].split('='); |
| 206 result[pair[0]] = decodeURIComponent(pair[1]); | 212 result[pair[0]] = decodeURIComponent(pair[1]); |
| 207 } | 213 } |
| 208 return result; | 214 return result; |
| 209 } | 215 } |
| OLD | NEW |