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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // Parse URL parameters. | 86 // Parse URL parameters. |
| 87 var urlParams = getUrlParameters_(); | 87 var urlParams = getUrlParameters_(); |
| 88 if ('mode' in urlParams) { | 88 if ('mode' in urlParams) { |
| 89 if (urlParams['mode'] == 'me2me') { | 89 if (urlParams['mode'] == 'me2me') { |
| 90 var hostId = urlParams['hostId']; | 90 var hostId = urlParams['hostId']; |
| 91 remoting.connectMe2Me(hostId); | 91 remoting.connectMe2Me(hostId); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 // No valid URL parameters, start up normally. | 95 // No valid URL parameters, start up normally. |
| 96 remoting.initDaemonUi(); | 96 remoting.initHomeScreenUi(); |
| 97 } | 97 } |
| 98 remoting.hostList.load(onLoad); | 98 remoting.hostList.load(onLoad); |
| 99 | 99 |
| 100 // Show the tab-type warnings if necessary. | 100 // Show the tab-type warnings if necessary. |
| 101 /** @param {boolean} isWindowed */ | 101 /** @param {boolean} isWindowed */ |
| 102 var onIsWindowed = function(isWindowed) { | 102 var onIsWindowed = function(isWindowed) { |
| 103 if (!isWindowed && | 103 if (!isWindowed && |
| 104 navigator.platform.indexOf('Mac') == -1) { | 104 navigator.platform.indexOf('Mac') == -1) { |
| 105 document.getElementById('startup-mode-box-me2me').hidden = false; | 105 document.getElementById('startup-mode-box-me2me').hidden = false; |
| 106 document.getElementById('startup-mode-box-it2me').hidden = false; | 106 document.getElementById('startup-mode-box-it2me').hidden = false; |
| 107 } | 107 } |
| 108 }; | 108 }; |
| 109 isWindowed_(onIsWindowed); | 109 isWindowed_(onIsWindowed); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Display the user's email address and allow access to the rest of the app, | 113 * Display the user's email address and allow access to the rest of the app, |
| 114 * including parsing URL parameters. | 114 * including parsing URL parameters. |
| 115 * | 115 * |
| 116 * @param {string} email The user's email address. | 116 * @param {string} email The user's email address. |
| 117 * @return {void} Nothing. | 117 * @return {void} Nothing. |
| 118 */ | 118 */ |
| 119 remoting.onEmail = function(email) { | 119 remoting.onEmail = function(email) { |
| 120 document.getElementById('current-email').innerText = email; | 120 document.getElementById('current-email').innerText = email; |
| 121 document.getElementById('get-started-it2me').disabled = false; | 121 document.getElementById('get-started-it2me').disabled = false; |
| 122 document.getElementById('get-started-me2me').disabled = false; | 122 document.getElementById('get-started-me2me').disabled = false; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 /** initDaemonUi is called if the app is not starting up in session mode, and | 125 /** initDaemonUi is called if the app is not starting up in session mode, and |
|
garykac
2013/03/20 20:51:52
s/initDaemonUi/initHomeScreenUi/
| |
| 126 * also if the user cancels pin entry or the connection in session mode. */ | 126 * also if the user cancels pin entry or the connection in session mode. */ |
| 127 remoting.initDaemonUi = function() { | 127 remoting.initHomeScreenUi = function() { |
| 128 remoting.hostController = new remoting.HostController(); | 128 remoting.hostController = new remoting.HostController(); |
| 129 document.getElementById('share-button').disabled = | 129 document.getElementById('share-button').disabled = |
| 130 !remoting.hostController.isPluginSupported(); | 130 !remoting.hostController.isPluginSupported(); |
| 131 remoting.setMode(remoting.AppMode.HOME); | 131 remoting.setMode(remoting.AppMode.HOME); |
| 132 if (!remoting.oauth2.isAuthenticated()) { | 132 if (!remoting.oauth2.isAuthenticated()) { |
| 133 document.getElementById('auth-dialog').hidden = false; | 133 document.getElementById('auth-dialog').hidden = false; |
| 134 } | 134 } |
| 135 remoting.hostSetupDialog = | 135 remoting.hostSetupDialog = |
| 136 new remoting.HostSetupDialog(remoting.hostController); | 136 new remoting.HostSetupDialog(remoting.hostController); |
| 137 // Display the cached host list, then asynchronously update and re-display it. | 137 // Display the cached host list, then asynchronously update and re-display it. |
| 138 remoting.updateLocalHostState(); | 138 remoting.updateLocalHostState(); |
| 139 remoting.hostList.refresh(remoting.updateLocalHostState); | 139 remoting.hostList.refresh(remoting.updateLocalHostState); |
| 140 remoting.initSurvey(); | |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 /** | 143 /** |
| 143 * Fetches local host state and updates host list accordingly. | 144 * Fetches local host state and updates host list accordingly. |
| 144 */ | 145 */ |
| 145 remoting.updateLocalHostState = function() { | 146 remoting.updateLocalHostState = function() { |
| 146 /** | 147 /** |
| 147 * @param {remoting.HostController.State} state Host state. | 148 * @param {remoting.HostController.State} state Host state. |
| 148 * @param {string?} localHostId | 149 * @param {string?} localHostId |
| 149 */ | 150 */ |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 } else { | 339 } else { |
| 339 chrome.windows.get(tab.windowId, null, windowCallback); | 340 chrome.windows.get(tab.windowId, null, windowCallback); |
| 340 } | 341 } |
| 341 }; | 342 }; |
| 342 if (chrome.tabs) { | 343 if (chrome.tabs) { |
| 343 chrome.tabs.getCurrent(tabCallback); | 344 chrome.tabs.getCurrent(tabCallback); |
| 344 } else { | 345 } else { |
| 345 console.error('chome.tabs is not available.'); | 346 console.error('chome.tabs is not available.'); |
| 346 } | 347 } |
| 347 } | 348 } |
| OLD | NEW |